Re: [GIT PULL] Please pull mergetool.git
From: Theodore Tso <tytso@mit.edu>
Date: 2016-06-15 22:42:59
On Wed, Mar 14, 2007 at 01:59:23AM -0400, Shawn O. Pearce wrote:
Theodore Ts'o [off-list ref] wrote:quoted
+ base_mode=`git ls-files -u -- "$path" | awk '{if ($3==1) print $1;}'` + local_mode=`git ls-files -u -- "$path" | awk '{if ($3==2) print $1;}'` + remote_mode=`git ls-files -u -- "$path" | awk '{if ($3==3) print $1;}'` + + base_present && git cat-file blob ":1:$path" > "$BASE" 2>/dev/null + local_present && git cat-file blob ":2:$path" > "$LOCAL" 2>/dev/null + remote_present && git cat-file blob ":3:$path" > "$REMOTE" 2>/dev/nullWhy not use `git checkout-index --stage=all "$path"` ? E.g.: git checkout-index --stage=all "$path" | read base_temp local_temp remote_temp path I'm not trying to nitpick, I'm just curious about why this particular feature of checkout-index was not useful here.
1) I didn't know about it. 2) If I used it would I have to have renamed the files to <path>.LOCAL, <path>.BASE, et.al, because with most of the graphical merge tools, the filename is the only thing which gets displayed to tell the user which file came from the local branch or the remote branch or the base revision --- since file names such as .merge_file_QBaxrn and .merge_file_prSEqs don't have a lot of human meaning..... So I don't know that it would havce saved much in the script. You replace three invocations to git-cat-file with one invocation to git-checkout-index plus three invocations to mv. Regards, - Ted