git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Daniel Barkalow <barkalow@iabervon.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Call Me Gitless
Date: Tue, 19 Aug 2008 04:42:42 -0700 (PDT)	[thread overview]
Message-ID: <m3od3ps02b.fsf@localhost.localdomain> (raw)
In-Reply-To: <7vy72tit90.fsf@gitster.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> writes:

> 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.

> 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

  parent reply	other threads:[~2008-08-19 11:43 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-18  0:02 Call Me Gitless Trans
2008-08-18  0:28 ` Benjamin Sergeant
2008-08-18  0:40 ` Martin Langhoff
2008-08-18  8:50 ` Pascal Obry
2008-08-18 16:43 ` Jon Loeliger
2008-08-18 19:22 ` Daniel Barkalow
2008-08-18 20:17   ` Marcus Griep
2008-08-18 20:20   ` Junio C Hamano
2008-08-18 21:31     ` Daniel Barkalow
2008-08-18 22:30       ` Junio C Hamano
2008-08-18 23:12         ` Daniel Barkalow
2008-08-19  3:22           ` Junio C Hamano
2008-08-19  3:55             ` Marcus Griep
2008-08-19  6:47               ` Junio C Hamano
2008-08-19  7:02                 ` Junio C Hamano
2008-08-20  8:00                   ` [PATCH v2] diff: vary default prefix depending on what are compared Junio C Hamano
2008-08-20  9:06                     ` Jakub Narebski
2008-08-19  6:28             ` Call Me Gitless Stephen R. van den Berg
2008-08-19 11:42             ` Jakub Narebski [this message]
2008-08-19 18:18               ` Junio C Hamano
2008-08-19 17:52             ` Jeff King
2008-08-19 18:39               ` Daniel Barkalow
2008-08-19 18:45                 ` Jeff King
2008-08-19 18:57                   ` Daniel Barkalow
2008-08-19 19:01                     ` Jeff King
2008-08-19 19:42                       ` Daniel Barkalow
2008-08-19 20:33                         ` Petr Baudis
2008-08-19 21:49                           ` Daniel Barkalow
2008-08-19 19:43               ` Junio C Hamano
2008-08-19  7:25       ` Junio C Hamano
2008-08-19 19:22         ` Daniel Barkalow
2008-08-21  3:40       ` Sverre Hvammen Johansen
2008-08-21  8:41       ` Junio C Hamano
2008-08-21  8:43         ` [PATCH 1/3] sha1_object_info(): pay attention to cached objects Junio C Hamano
2008-08-21  8:43         ` [PATCH 2/3] cached_object: learn empty blob Junio C Hamano
2008-08-21  8:44         ` [PATCH 3/3] git-add --intent-to-add (-N) Junio C Hamano
2008-08-21 14:23           ` Paolo Bonzini
2008-08-21 21:14           ` Jonathan Nieder
2008-08-22  4:10             ` Jonathan Nieder
2008-08-22  4:34               ` Daniel Barkalow
2008-08-22  4:59                 ` Junio C Hamano
2008-08-22  5:32                 ` Jonathan Nieder
2008-08-22  5:59                   ` Junio C Hamano
2008-08-22  6:38                     ` Jonathan Nieder
2008-08-22  7:52                       ` Jonathan Nieder
2008-08-21 13:58         ` Call Me Gitless Daniel Barkalow
2008-08-18 23:24     ` Tarmigan
2008-08-19  0:32       ` Daniel Barkalow
2008-08-19  0:45         ` Tarmigan
2008-08-19  7:53       ` "Peter Valdemar Mørch (Lists)"
2008-08-19  8:01         ` Junio C Hamano
2008-08-19  8:10           ` Imran M Yousuf
2008-08-19  8:26             ` "Peter Valdemar Mørch (Lists)"
2008-08-19  8:53               ` Imran M Yousuf
2008-08-19  8:57           ` Alexander E Genaud
2008-08-19  9:11             ` Matthieu Moy
2008-08-19  9:36               ` Mike Hommey
2008-08-19 10:09               ` Alexander E Genaud
2008-08-19 11:27                 ` Pascal Obry
2008-08-21 14:15                   ` Paolo Bonzini
2008-08-22 19:10                     ` Elijah Newren
2008-08-19 10:16               ` "Peter Valdemar Mørch (Lists)"
2008-08-19 11:31             ` Mark Struberg
2008-08-19 12:04               ` Alexander E Genaud
2008-08-19 18:15                 ` Junio C Hamano
2008-08-19  8:56         ` Teemu Likonen
2008-08-19 13:15 ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3od3ps02b.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).