[lkml]   [2005]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Updated git HOWTO for kernel hackers

    On Thu, 23 Jun 2005, Jeff Garzik wrote:
    > Locally I have scripted
    > git-diff-cache -p HEAD | diffstat -p1 | awk '{print $1}' > /tmp/lst
    > git-update-cache `cat /tmp/lst`
    > because of this.

    Btw, that's some extremely convoluted computation.

    This is exactly when you do _not_ want the diff in "patch" form, and you
    really want the native git format (which is just a strange "this file
    changed from this mode/sha1 to that mode/sha1" format).

    So instead, try to do just

    git-diff-cache HEAD | cut -f2

    and now it's going to be a whole lot simpler and faster - it won't turn
    things into a diff only to do a "diffstat" on it to turn it into a name
    again. I bet it's more reliable too.

    > [again, clearly doesn't work with remove/add/mode change]

    Well, it actually can work with removes, and rewriting it to be a bit
    more clean (and handle files that start with "-") gives you:

    git-update-cache --remove -- $(git-diff-cache HEAD | cut -f2)

    which should actually work fine for files that you have removed. But yes,
    it fundamentally _cannot_ work for new files, of course, since git will
    never even try to look for files you haven't told it about. So you always
    have to add files by hand some way.

    Note how the "--remove" parameter to git-update-cache really only means
    "it's ok if some of the files mentioned don't exist any more, and that
    means you should remove them from the cache".

    Without the "--remove" flag, a filename that is listed but that doesn't
    exist in the working tree is either considered an error, or is ignored
    (depending on the "--ignore-missing" flag).

    That's actually what "--add" means too: it means "it's ok if some of the
    filenames on the command line don't currently exist in the index: if they
    exist in the working directory, you should add them".

    So even if it looks a bit strange, in a script it actually makes perfect
    sense to write something that seems as _apparently_ senseless as:

    git-update-cache --add --remove --refresh -- "$@"

    and it will refresh all existing files, and add or remove any files
    explicitly mentioned that either exist or have been removed in the working

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2009-11-18 23:46    [W:0.024 / U:8.128 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site