Re: Call Me Gitless
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Aug 19, 2008, 11:42 UTC
- Message-ID
- <m3od3ps02b.fsf@localhost.localdomain>
- In-Reply-To
- <7vy72tit90.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 34 quoted lines
> Daniel Barkalow <barkalow@iabervon.org> writes:
>
> > Actually, this weekend I was trying to cherry-pick the aggregated changes
> > to certain files from one branch onto another, and was repeatedly confused
> > by the fact that the only available diffs are backwards and there're no
> > clues in the output. (That is, you can't get the difference between (---)
> > the {index,working tree} and (+++) some commit, and when you've done "git
> > diff messy", the resulting diff doesn't give any clues that you're
> > deciding whether to add the - lines and remove the + lines.)
>
> I do not know if I like the end result, but here is a patch to make the
> traditional a/ and b/ prefix more mnemonic.
>
> A lot of existing tests and documentation need to be updated, if we were
> to do this, though. The first test to fail is t1200-tutorial.sh.
>
> Obviously not tested except for creating this patch that pretends to be a
> format-patch output. You can tell that I just did this only in the work
> tree now.
>
> -- >8 --
> diff: vary default prefix depending on what are compared
>
> This implements Daniel's idea to indicate what are compared by using
> prefix different from the traditional a/ and b/ in the textual diff
> header:
>
> "git diff" compares the (i)ndex and the (w)ork tree;
> "git diff HEAD" compares a (c)ommit and the (w)ork tree;
> "git diff --cached" compares a (c)ommit and the (i)ndex;
> "git diff HEAD:f /tmp/f" compares an (o)bject and (w)ork tree.
>
> Because these mnemonics now have meanings, they are swapped when reverse
> diff is in effect.Show 12 quoted lines
> diff --git i/builtin-diff.c w/builtin-diff.c
> index 7ffea97..ecec753 100644
> --- i/builtin-diff.c
> +++ w/builtin-diff.c
> @@ -74,6 +74,8 @@ static int builtin_diff_b_f(struct rev_info *revs,
> if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)))
> die("'%s': not a regular file or symlink", path);
>
> + diff_set_default_prefix(&revs->diffopt, "o/", "w/");
> +
> if (blob[0].mode == S_IFINVALID)
> blob[0].mode = canon_mode(st.st_mode);I was thinking about reusing estended SHA1 syntax in the form of :0:a/file or ::a/file for index, a/file for working directory, and HEAD:a/file for a tree version. But your way is I think better; of course if you remember mnemonics (and they are documented, aren't they?).
BTW. I wonder why in above patch, which I guess is result of running git-format-patch and should be between TWO TREES, doesn't use standard 'a/' and 'b/' (git-show should also use standard, default prefixes).
-- Jakub Narebski Poland ShadeHawk on #git