Git development
 help / color / mirror / Atom feed
* Re: Following renames
From: Marco Costalba @ 2006-03-26 19:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Jakub Narebski, git
In-Reply-To: <Pine.LNX.4.64.0603260947100.15714@g5.osdl.org>

On 3/26/06, Linus Torvalds <torvalds@osdl.org> wrote:
>
>
> So wouldn't it be _much_ nicer to have a "graphical git-whatchanged",
> where you just delve deeper (and you don't even look at the whole file
> like git-whatchanged does, but you ask for a very particular region).
>
> Ie, what I imagine would be something gitk/qgit like, where you see the
> file content, select a line or two (or a whole function), and it goes back
> in history and shows you the last diff that changed that
> line/two/function. We can do that EFFICIENTLY. Much more efficiently than
> git-annotate, in fact. And then when you see the diff, you might say "I'm
> not interested in this one, that was just a re-indent" and then continue
> back.
>
> THAT is the kind of graphical tool I'd want. And dammit, it should even be
> _easy_. I'm just a total clutz myself when it comes to doing things like
> QT or nice tcl/tk text-panes, and this really does have to be visual,
> since the whole point is that "select text" and interactive part.
>
> So if somebody wants to be a hero, and feels comfortable with those kinds
> of things, this really should be a fairly straightforward thing to do (it
> would be useful even without rename detection or data movement detection,
> but it's also something where you really _could_ do efficient data
> movement detection by just looking at the "whole diff" when something
> changed in that small area).
>

I am a thousand miles away from being an hero (and glad of it), but....

I really need a bit of feedback or comment about this because IMHO
qgit annotate is *almost* very similar to what you would ask, so I
need to understand well the difference:

FIRST WAY

After annotating a file history (double click on a file name in
bottom-right window or directly from tree view), you see the whole
file annotated. If you have the diff window open you see also the
corresponding patch (scrolled to selected file name).

Now, double clicking on the chosen code line in file content makes
currently two things:

  - Diff window is updated to show corresponding revision patch, i.e.
the last patch that modified that line of code.

- File content, as well as file annotation, changes to show the
content of the file just after the patch was applied, from there it is
normally possible to go back in the history of that code region in the
same way, i.e. double clicking on interesting lines.

Biggest limitation of 'annotation browsing' is that 'code removing
only' patches are not annotated and you need to check them  directly
in diff window.

SECOND WAY

Without opening the file viewer it is possible to select a file (or
more then one or one directory) from tree view and press magic wand
button. This causes main view to be updated with git-rev-list  --
<selected paths>  content, i.e. a filtered view.

With diff viewer window open you can browse across file patch history
related to chosen file.

Biggest limitation is that all the revisions who touch the file are
shown, not only the ones limited to a selected region.

IF I HAVE UNDERSTOOD...

If I have understood what you would like to see it something like the following:

- From diff/file viewer window select a code region.

- Press Magic wand button and feed git-rev-list with <selected path>
_and_  <selected content>

- Show git-rev-list output on main window as usual, but now selected
revisions are filtered out not only for path but also for region of
code touched.


Am I guessing correctly?

Marco

^ permalink raw reply

* Re: Following renames
From: Petr Baudis @ 2006-03-26 19:14 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Ryan Anderson, git
In-Reply-To: <Pine.LNX.4.64.0603260829550.15714@g5.osdl.org>

Dear diary, on Sun, Mar 26, 2006 at 06:33:13PM CEST, I got a letter
where Linus Torvalds <torvalds@osdl.org> said that...
> If you do
> 
> 	git-rev-list --parents --remove-empty $REV -- $filename
> 
> then you'll get the whole history for that filename. When it ends, you 
> know the file went away, and then you do basically _one_ "where the hell 
> did it go" thing.
> 
> And yes, it's not git-ls-tree (unless you only want to follow pure 
> renames), it's actually one "git-diff-tree -M $lastrev". Then you just 
> continue with the new filename (and do another "git-rev-list" until you 
> hit the next rename).

I wrote a long rant but then it all suddenly fit together and I have now
an idea how to implement it reasonably elegantly.

So only a bugreport remains:

My current target is to support this tree (letters are filenames,
numbers are commit ids; I'll translate any git output to those digits):

    2    4
    b -- d
1 /        \ 6
a            d
  \ 3    5 /
    c -- d

With the commits created in the numerical order (so log shows
1,2,3,4,5,6, and my target is cg-log d showing the same output). If
anyone wants the sample history, it's at

	http://pasky.or.cz/~xpasky/renametree1.git/

Curiously, git-rev-list does something totally strange when trying to
list per-file history at this point:

	$ git-rev-list HEAD -- d
	4

Huh? (It should list 6, 5, 4 instead.)

I worked it around by recording a change in d in the merge 6:

	http://pasky.or.cz/~xpasky/renametree2.git/

	$ git-rev-list --parents --remove-empty HEAD -- d
	6 4 5
	5
	4

Which is the expected output.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* Re: Use a *real* built-in diff generator
From: Petr Baudis @ 2006-03-26 18:20 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Linus Torvalds, Davide Libenzi, Morten Welinder, Junio C Hamano,
	Git Mailing List
In-Reply-To: <20060326110934.GA3774@linux-mips.org>

Dear diary, on Sun, Mar 26, 2006 at 01:09:35PM CEST, I got a letter
where Ralf Baechle <ralf@linux-mips.org> said that...
> On Sat, Mar 25, 2006 at 10:39:03AM -0800, Linus Torvalds wrote:
> 
> > Besides, I hate how GNU patch bends over backwards in applying crap that 
> > isn't a proper patch at all (whitespace-corruption, you name it: GNU patch 
> > will accept it). Also, I made "git-apply" be all-or-nothing: either it 
> > applies the _whole_ patch (across many different files) or it applies none 
> > of it. With GNU patch, if you get an error on the fifth file, the four 
> > first files have been modified already - aarrgghhh..
> 
> Which is apply's greatest strength - and weakness.  GNU diff doesn't
> understand the file renamings bits of git diffs, so they they need to be
> used with apply.  So if a patch doesn't apply?  Apply doesn't even have
> an option to apply things as good as it can and leave the rest in
> reject files.  Yuck.

I've just updated cg-patch on the master branch today to understand file
renames, so it should be possible to use it for applying fuzzy patches.
(OTOH, cg-patch has grown way too complex and ugly for my taste. It'd be
nice if git-apply could take over the ugly part of the task.)

No dice with patches containing copy information, though. We would need
to perform the copy _before_ applying the patch itself and we have no
infrastructure for that (so far it has been enough to do the
git-specific stuff after applying the patch itself).

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* Re: minimum set of utils for git 'server'?
From: Linus Torvalds @ 2006-03-26 18:16 UTC (permalink / raw)
  To: Paul Jakma; +Cc: git list
In-Reply-To: <Pine.LNX.4.64.0603261804180.5276@sheen.jakma.org>



On Sun, 26 Mar 2006, Paul Jakma wrote:
> 
> What is the minimum set of git utilities required for a git 'server'?
> 
> 	git-receive-pack
> 	git-daemon
> 	git-init-db
> 	git-repack
> 	git-fsck-objects

At least git-upload-pack, git-pack-objects, git-rev-list and 
git-unpack-objects (which are all part of the object receive/send paths), 
and git-update-server-info if you do http.

> I have an old server, but it lacks recent python (for merge-recursive), so I'd
> like to ensure no one accidently tries to do actual merging locally. Only the
> bare minimum needed for a central git 'server' desired.

You should be able to just try it out. Start out with the above list, and 
see what complains...

		Linus

^ permalink raw reply

* Re: Following renames
From: Linus Torvalds @ 2006-03-26 18:10 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <e06hts$1ne$1@sea.gmane.org>



On Sun, 26 Mar 2006, Jakub Narebski wrote:
> 
> If (2) is common enough then discussed improvements to rename detection, 
> namely comparing basenames as a base for candidate selection is a good idea.

BK had this "renametool" which got started automatically when you applied 
a patch that removed one or more files and added one or more files, so 
that you could then pair up the files manually.

It left the rename pairing 100% to the user, but it helped a bit by 
guessing what the pairing might be, and yes, it used the basenames to set 
up that initial guess.

It worked in many cases, but it also failed in many cases. I do think it 
was a useful heuristic within the BK model (since the _real_ choice was 
left to the user), but I don't think it's very useful for git.

The thing is, the fast rename detection that is in the "next" branch 
really does a lot better, and it's fast enough.

(If you wanted to make it even faster, but less precise, you could limit 
it to the first few kilobytes of file contents - still a _lot_ better 
heuristic than the actual filename, and it would make the worst-case 
behaviour much better).

> I wonder how common is (2) compared to (1)+(2) i.e. move to other dir 
> and rename, old-dir/old-file.c to new-dir/new-subdir/new-file.c

I don't have any numbers, but from usign renametool for a few years, my 
gut feel/recollection is that about half of renames in the kernel were 
moving to a new directory, and about half changed names (often in 
_addition_ to moving). But I didn't much think about it, so that's just a 
very rough guess based on using a tool that helped you do these things 
manually.

For example, one common case was a directory structure like

	..
	type-file1.c
	type-file2.c
	otherfiles.c
	yet-more.c
	..

being split up into a subdirectory

	..
	type/file1.c
	type/file2.c
	otherfiles.c
	yet-more.c
	..

(eg drivers/scsi/aic7xx-* being given a subdirectory of it's own, as 
drivers/scsi/aic7xx/*). So the basename wouldn't stay the same, because it 
contained some piece of data that became redundant with the move.

> >> 3.) splitting file into modules, huge-file.c to file1.c, file2.c?
> >> 4.) copying fragment of one file to other?
> >> 5.) moving fragment of code from one file to other?
> > 
> > I'd say that (5) is very common. And (4) happens a lot under certain
> > circumstances (new driver, new architecture, new filesystem..).
> > 
> > Doing (3) happens, but probably less often that it should ;/
> 
> Detecting (4) and (5) fast (i.e. for merges) without auxilary (helper) 
> information would probably be hard. For interrogation/porcellanish commands
> (like pickaxe) would probably be easier.

Yes. I don't think we necessarily want to merge automatically across 
things like that, even if it sounds like something you'd want in a perfect 
world. Stupid and obvious (and fails) is often better than smart and 
complex (and succeeds), because at least you _understand_ what happens. 

But _following_ a particular change back is important, and should be both 
efficient and simple to do. Ie the example tool I talked about in

        http://article.gmane.org/gmane.comp.version-control.git/217

is still relevant and important, I think.

I literally think that people wouldn't even _want_ a "git annotate", if 
they instead had more of a visual tool that showed the current state of 
the file, and you could click on a line/set of lines to follow it back to 
the previous change to that area. I'd argue that almost always when you 
want "annotate", you already have the particular place that you want to 
look at in mind (you're really not interested in the whole file).

So wouldn't it be _much_ nicer to have a "graphical git-whatchanged", 
where you just delve deeper (and you don't even look at the whole file 
like git-whatchanged does, but you ask for a very particular region).

Ie, what I imagine would be something gitk/qgit like, where you see the 
file content, select a line or two (or a whole function), and it goes back 
in history and shows you the last diff that changed that 
line/two/function. We can do that EFFICIENTLY. Much more efficiently than 
git-annotate, in fact. And then when you see the diff, you might say "I'm 
not interested in this one, that was just a re-indent" and then continue 
back. 

THAT is the kind of graphical tool I'd want. And dammit, it should even be 
_easy_. I'm just a total clutz myself when it comes to doing things like
QT or nice tcl/tk text-panes, and this really does have to be visual, 
since the whole point is that "select text" and interactive part.

So if somebody wants to be a hero, and feels comfortable with those kinds 
of things, this really should be a fairly straightforward thing to do (it 
would be useful even without rename detection or data movement detection, 
but it's also something where you really _could_ do efficient data 
movement detection by just looking at the "whole diff" when something 
changed in that small area).

		Linus

^ permalink raw reply

* Re: [PATCH] Avoid slowness when timewarping large trees.
From: Petr Baudis @ 2006-03-26 18:05 UTC (permalink / raw)
  To: git
In-Reply-To: <20060325093957.GA27832@coredump.intra.peff.net>

Dear diary, on Sat, Mar 25, 2006 at 10:39:57AM CET, I got a letter
where Jeff King <peff@peff.net> said that...
> tree_timewarp was calling read, egrep, and rm in an O(N) loop where N is
> the number of changed files between two trees. This caused a bottleneck
> when seeking/switching/merging between trees with many changed files.
> 
> Signed-off-by: Jeff King <peff@peff.net>

Thanks, applied.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* [ANNOUNCE] Cogito-0.17.1
From: Petr Baudis @ 2006-03-26 17:56 UTC (permalink / raw)
  To: git; +Cc: linux-kernel

  Hello,

  cogito-0.17.1 was just released, the next release on the latest stable
line of the Cogito user-friendly Git user interface. Note that the
stable stuff is now happening on the v0.17 branch, just like we did in
the 0.16 times. In addition to that, however, an auto-built
documentation in the man, txt and html format is available in the

	http://www.kernel.org/pub/scm/cogito/cogito-doc.git/

repository. It has the same branch structure as the cogito.git
repository and should also have the same tags if my scripts work
properly. Thanks to Junio for the base version of the script maintaining
this repository.

  So, what's new?

  * Fixed several minor relative path related cg-add and cg-status bugs
  * Fixed cg-add -r not readding cg-rm'd files
  * Fixed support for branch names containing slashes

  * cg-admin-rewritehist - the universal history rewriting tool
  * cg-commit --author
  * cg-commit -p alias for cg-commit --review
  * cg-status -S will show the full contents of the untracked
    directories instead of just the directory name
  * $CG_NORC will make Cogito ignore ~/.cgrc
  * https:// URLs are supported now

  * Several small speed-ups (especially --topo-order in cg-mkpatch)
  * Random documentation updates (most notably cg-ref quick reference)
  * The tutorial script updated


  Who did what:

Dennis Stosberg:
      Cogito: Allow https:// URLs

Jonas Fonseca:
      cg-export: document the -r option
      [PATCH 1/4] Simplify wildcards for match files to be ignored
      [PATCH 2/4] Encode the manpage section in the file name
      [PATCH 3/4] Generate PDF documents using docbook2pdf
      [PATCH 4/4] Add quick reference (cg-ref) to the documentation suite
      Fix multi-paragraph list items in OPTIONS section

Pavel Roskin:
      Use Cogito when possible in the "tutorial" test.
      [PATCH 3/3] Allow the tutorial script to be run by "make test"
      [PATCH 1/3] cg-mv doesn't work with bash 3.1.7 due to excessive quotes
      Clean up after failed "git merge" in the tutorial script

Petr Baudis:
      Refer to cg-branch-add in cg-clone docs and clarify stuff
      Add example usage to cg-clone per jbl's request
      Easier cut'n'paste
      --merge-order is too slow, always use --topo-order
      TODO: branches/with/slashes and cg-clone -a
      Add cg-commit --author, consolidate author documentation
      Update for the modern conflicts handling
      Improve cg-switch -r shortdesc
      Expand the git-mv workarounds description
      cg-merge: Do not fast-forward when doing an octopus
      Fix some relpath-related cg-add and cg-status bugs
      Make cg-commit -p synonymous with --review
      TODO: cg-shelf - shelve changes temporarily
      Generalize the tac stub (cg-mkpatch -> cg-Xlib)
      Generalize pick_author() to pick_id()
      cg-admin-rewritehist - history rewriting swiss knife
      Update the example usage
      Hopefully fix cg-admin-rewritehist -r
      Umm, update year in the (c) notice ;)
      Properly support multiple -r arguments
      Make the main cycle more efficient
      Another optimization - retrieve the commit object only once
      Accept subsections inside the OPTIONS section
      Do not load ~/.cgrc if $CG_NORC is set
      Remove bogus information from cg-patch docs
      Properly document cg-commit --signoff=STRING
      cg-admin-rewritehist --parent-filter for rewriting parent string
      cg-admin-rewritehist --commit-filter for omitting commits
      Reference cg-ref(7) from cogito(7)
      A quick docs pointer and Getting help section update
      cg-status -S will turn dirsquashing off
      Fix cg-add -r not readding removed files
      Use the new ref format when resetting the HEAD file
      Fix support for branch names containing slashes


P.S.: See us at #git @ FreeNode!

  Happy hacking,

-- 
				Petr "Pasky the lousy poet" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe.  -- Douglas Adams

^ permalink raw reply

* minimum set of utils for git 'server'?
From: Paul Jakma @ 2006-03-26 17:13 UTC (permalink / raw)
  To: git list

Hi,

What is the minimum set of git utilities required for a git 'server'?

 	git-receive-pack
 	git-daemon
 	git-init-db
 	git-repack
 	git-fsck-objects
 	?
 	?

I have an old server, but it lacks recent python (for 
merge-recursive), so I'd like to ensure no one accidently tries to do 
actual merging locally. Only the bare minimum needed for a central 
git 'server' desired.

?

regards,
-- 
Paul Jakma	paul@clubi.ie	paul@jakma.org	Key ID: 64A2FF6A
Fortune:
The faster I go, the behinder I get.
 		-- Lewis Carroll

^ permalink raw reply

* Re: Following renames
From: Jakub Narebski @ 2006-03-26 17:10 UTC (permalink / raw)
  To: git
In-Reply-To: <Pine.LNX.4.64.0603260843250.15714@g5.osdl.org>

Linus Torvalds wrote:

> On Sun, 26 Mar 2006, Jakub Narebski wrote:
>>
>> I wonder what is the most common case in Linux kernel or git.
>> 
>> 1.) renaming the file in the same directory, old-file.c to new-file.c?
>> 2.) moving file to other directory (project reorganization), 
>>     old-dir/file.c to new-dir/file.c?
> The kernel uses subdirectories extensively, and a lot of renames (most of
> them, I'd say) is because of that subdirectory structure.
> 
> So the same-directory case is the unusual one, I'd say.

If (2) is common enough then discussed improvements to rename detection, 
namely comparing basenames as a base for candidate selection is a good idea.
I wonder how common is (2) compared to (1)+(2) i.e. move to other dir 
and rename, old-dir/old-file.c to new-dir/new-subdir/new-file.c

>> 3.) splitting file into modules, huge-file.c to file1.c, file2.c?
>> 4.) copying fragment of one file to other?
>> 5.) moving fragment of code from one file to other?
> 
> I'd say that (5) is very common. And (4) happens a lot under certain
> circumstances (new driver, new architecture, new filesystem..).
> 
> Doing (3) happens, but probably less often that it should ;/

Detecting (4) and (5) fast (i.e. for merges) without auxilary (helper) 
information would probably be hard. For interrogation/porcellanish commands
(like pickaxe) would probably be easier.

-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply

* Re: Following renames
From: Linus Torvalds @ 2006-03-26 16:46 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <e06fl8$p9f$1@sea.gmane.org>



On Sun, 26 Mar 2006, Jakub Narebski wrote:
>
> I wonder what is the most common case in Linux kernel or git.
> 
> 1.) renaming the file in the same directory, old-file.c to new-file.c?

The kernel uses subdirectories extensively, and a lot of renames (most of 
them, I'd say) is because of that subdirectory structure. 

So the same-directory case is the unusual one, I'd say.

> 3.) splitting file into modules, huge-file.c to file1.c, file2.c?
> 4.) copying fragment of one file to other?
> 5.) moving fragment of code from one file to other?

I'd say that (5) is very common. And (4) happens a lot under certain 
circumstances (new driver, new architecture, new filesystem..).

Doing (3) happens, but probably less often that it should ;/

		Linus

^ permalink raw reply

* Re: Following renames
From: Linus Torvalds @ 2006-03-26 16:43 UTC (permalink / raw)
  To: Timo Hirvonen; +Cc: Junio C Hamano, pasky, git
In-Reply-To: <20060326190836.dbe95a72.tihirvon@gmail.com>



On Sun, 26 Mar 2006, Timo Hirvonen wrote:
>
> $ git-whatchanged old-file.c
> fatal: 'old-file.c': No such file or directory
> 
> $ touch old-file.c
> $ git-whatchanged old-file.c
> 
> Hah, it worked!

It worked even before:

	git-whatchanged -- old-file.c

always works.

If you think of the "filename spec" as _always_ having to have a "--" to 
separate the filenames from the other arguments, you're thinking the right 
way. Then, there's a _shorthand_ for existing files, where we allow users 
being lazy (because _I_ am very lazy indeed), which allows dropping of the 
"--", but then the code requires that the filenames are real filenames as 
of now.

> Hmm... this works too without the touch-hack:
> 
> $ git-whatchanged file.c old-file.c
> 
> I wish I had known this before.

Actually, it -shouldn't- work. It's just that "git-rev-parse" isn't as 
anal as it should be.

Here's a fix.

		Linus
----
diff --git a/rev-parse.c b/rev-parse.c
index f90e999..104b1e2 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -172,7 +172,9 @@ int main(int argc, char **argv)
 		char *dotdot;
 	
 		if (as_is) {
-			show_file(arg);
+			if (show_file(arg) && as_is < 2)
+				if (lstat(arg, &st) < 0)
+					die("'%s': %s", arg, strerror(errno));
 			continue;
 		}
 		if (!strcmp(arg,"-n")) {
@@ -192,7 +194,7 @@ int main(int argc, char **argv)
 
 		if (*arg == '-') {
 			if (!strcmp(arg, "--")) {
-				as_is = 1;
+				as_is = 2;
 				/* Pass on the "--" if we show anything but files.. */
 				if (filter & (DO_FLAGS | DO_REVS))
 					show_file(arg);

^ permalink raw reply related

* Re: Following renames
From: Linus Torvalds @ 2006-03-26 16:33 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Ryan Anderson, git
In-Reply-To: <20060326100717.GD18185@pasky.or.cz>



On Sun, 26 Mar 2006, Petr Baudis wrote:
> 
> Huh? I don't see that now (and caps don't help me see it better). That's
> certainly not what is in [1], and I don't see _how_ to detect the
> renames in this case, and what would I be actually doing git-ls-tree for
> when I've already detected the rename. Based on [1], I'd be doing
> git-ls-tree merely to detect that a file _disappeared_ in the first
> place, I have to do other stuff to detect the renames themselves.

No, the point is that "git-rev-list" already does all of [1] in the core.

If you do

	git-rev-list --parents --remove-empty $REV -- $filename

then you'll get the whole history for that filename. When it ends, you 
know the file went away, and then you do basically _one_ "where the hell 
did it go" thing.

And yes, it's not git-ls-tree (unless you only want to follow pure 
renames), it's actually one "git-diff-tree -M $lastrev". Then you just 
continue with the new filename (and do another "git-rev-list" until you 
hit the next rename).

		Linus

^ permalink raw reply

* Re: Following renames
From: Jakub Narebski @ 2006-03-26 16:31 UTC (permalink / raw)
  To: git
In-Reply-To: <7virq1sywj.fsf@assigned-by-dhcp.cox.net>

I wonder what is the most common case in Linux kernel or git.

1.) renaming the file in the same directory, old-file.c to new-file.c?
2.) moving file to other directory (project reorganization), 
    old-dir/file.c to new-dir/file.c?
3.) splitting file into modules, huge-file.c to file1.c, file2.c?
4.) copying fragment of one file to other?
5.) moving fragment of code from one file to other?

-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply

* Re: Following renames
From: Timo Hirvonen @ 2006-03-26 16:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: pasky, git
In-Reply-To: <7virq1sywj.fsf@assigned-by-dhcp.cox.net>

On Sat, 25 Mar 2006 18:49:48 -0800
Junio C Hamano <junkio@cox.net> wrote:

> Looking at the evolution of rev-list.c file itself was a good
> exercise to realize that rename tracking (more specifically,
> having whatchanged to follow renames) is not such a useful
> thing (at least for me).

It would be useful for me.  I had all files organized in subdirectories,
but then noticed it was not good idea because make does not play nicely
with subdirs, so I moved all files to top level directory.

Now

    git-whatchanged -p file.c

stops at the big rename. To continue I have to do

    git-whatchanged -p -- <some-commit> <old-filename>

> Another example.  Today's tar-tree updates have one interesting
> function I think should belong to strbuf.c, and before merging
> it to the mainline, I may move that function from tar-tree.c to
> strbuf.c.  After that happens, if I run "whatchanged strbuf.c"
> to see where that function came from, I would want it to notice
> it came from tar-tree.c, although it is not a rename at all.
> Just one function moved from a file to another.

Yes in this case you can do

$ git-whatchanged strbuf.c
$ git-whatchanged tar-tree.c

but after rename...

$ git-whatchanged old-file.c
fatal: 'old-file.c': No such file or directory

$ touch old-file.c
$ git-whatchanged old-file.c

Hah, it worked!


Hmm... this works too without the touch-hack:

$ git-whatchanged file.c old-file.c

I wish I had known this before.

> What this suggests is that switching the set of paths to follow
> while traversing ancestry chain needs to depend on which part of
> the original file you are interested in.  Marking "this commit
> renames (or copies) file A to file B" is not that useful -- for
> that matter, detecting at runtime like we currently do is not
> better either.  If a file A and file B were cleaned up and
> merged into a single file C, which is in the tip of the tree,
> which one you would want whatchanged to switch following depends
> on which part of the C you were interested in.

OK, maybe following renames is not such a good idea.  But for GUIs
(gitk, qgit) following renames or even file merges (select a file to
follow by clicking it) would be big plus.

-- 
http://onion.dynserv.net/~timo/

^ permalink raw reply

* [PATCH] Optionally do not list empty directories in git-ls-files --others
From: Petr Baudis @ 2006-03-26 14:59 UTC (permalink / raw)
  To: junkio, Jim MacBaine; +Cc: git
In-Reply-To: <20060326142505.GL18185@pasky.or.cz>

 Hi,

Dear diary, on Sun, Mar 26, 2006 at 04:25:05PM CEST, I got a letter
where Petr Baudis <pasky@suse.cz> said that...
> Dear diary, on Mon, Feb 27, 2006 at 03:43:32PM CET, I got a letter
> where Jim MacBaine <jmacbaine@gmail.com> said that...
> > Many packages put empty directories under /etc, and although only a
> > few of those directories are actually needed, the automatic removal of
> > those packages will fail if I remove the empty directories manually.  
> > Equally, the removal will fail, if I put a .placeholder file into
> > those direrectories and cg-add it.  Is there a simple way out?
> 
>   this is caused by git-ls-files behaviour - we now call it with
> the --directory argument which is nice since it will show a non-empty
> unknown directory as a single entry and won't list all its contents.
> What is not so nice is the side-effect you are describing, and I tend
> to agree that if the directory is empty, it should not be listed.

  it turned out that cg-clean depends on the original behaviour (and it
makes sense there, we want to purge even empty directories). Therefore
this patch will preserve the old behaviour but add an option
--no-empty-directory. When that gets propagated to Git releases, I will
use it in cg-status.

---

Without the --directory flag, git-ls-files wouldn't ever list directories,
producing no output for empty directories, which is good since they cannot
be added and they bear no content, even untracked one (if Git ever starts
tracking directories on their own, this should obviously change since the
content notion will change).

With the --directory flag however, git-ls-files would list even empty
directories. This may be good in some situations but sometimes you want to
prevent that. This patch adds a --no-empty-directory option which makes
git-ls-files omit empty directories.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 Documentation/git-ls-files.txt |    3 +++
 ls-files.c                     |   33 +++++++++++++++++++++++++--------
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
index e813f84..980c5c9 100644
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -52,6 +52,9 @@ OPTIONS
 	If a whole directory is classified as "other", show just its
 	name (with a trailing slash) and not its whole contents.
 
+--no-empty-directory::
+	Do not list empty directories. Has no effect without --directory.
+
 -u|--unmerged::
 	Show unmerged files in the output (forces --stage)
 
diff --git a/ls-files.c b/ls-files.c
index e42119c..83b0a3b 100644
--- a/ls-files.c
+++ b/ls-files.c
@@ -20,6 +20,7 @@ static int show_unmerged = 0;
 static int show_modified = 0;
 static int show_killed = 0;
 static int show_other_directories = 0;
+static int hide_empty_directories = 0;
 static int show_valid_bit = 0;
 static int line_terminator = '\n';
 
@@ -258,11 +259,12 @@ static int dir_exists(const char *dirnam
  * Also, we ignore the name ".git" (even if it is not a directory).
  * That likely will not change.
  */
-static void read_directory(const char *path, const char *base, int baselen)
+static int read_directory(const char *path, const char *base, int baselen)
 {
-	DIR *dir = opendir(path);
+	DIR *fdir = opendir(path);
+	int contents = 0;
 
-	if (dir) {
+	if (fdir) {
 		int exclude_stk;
 		struct dirent *de;
 		char fullname[MAXPATHLEN + 1];
@@ -270,7 +272,7 @@ static void read_directory(const char *p
 
 		exclude_stk = push_exclude_per_directory(base, baselen);
 
-		while ((de = readdir(dir)) != NULL) {
+		while ((de = readdir(fdir)) != NULL) {
 			int len;
 
 			if ((de->d_name[0] == '.') &&
@@ -288,6 +290,7 @@ static void read_directory(const char *p
 
 			switch (DTYPE(de)) {
 			struct stat st;
+			int subdir, rewind_base;
 			default:
 				continue;
 			case DT_UNKNOWN:
@@ -301,22 +304,32 @@ static void read_directory(const char *p
 			case DT_DIR:
 				memcpy(fullname + baselen + len, "/", 2);
 				len++;
+				rewind_base = nr_dir;
+				subdir = read_directory(fullname, fullname,
+				                        baselen + len);
 				if (show_other_directories &&
-				    !dir_exists(fullname, baselen + len))
+				    (subdir || !hide_empty_directories) &&
+				    !dir_exists(fullname, baselen + len)) {
+					// Rewind the read subdirectory
+					while (nr_dir > rewind_base)
+						free(dir[--nr_dir]);
 					break;
-				read_directory(fullname, fullname,
-					       baselen + len);
+				}
+				contents += subdir;
 				continue;
 			case DT_REG:
 			case DT_LNK:
 				break;
 			}
 			add_name(fullname, baselen + len);
+			contents++;
 		}
-		closedir(dir);
+		closedir(fdir);
 
 		pop_exclude_per_directory(exclude_stk);
 	}
+
+	return contents;
 }
 
 static int cmp_name(const void *p1, const void *p2)
@@ -696,6 +709,10 @@ int main(int argc, const char **argv)
 			show_other_directories = 1;
 			continue;
 		}
+		if (!strcmp(arg, "--no-empty-directory")) {
+			hide_empty_directories = 1;
+			continue;
+		}
 		if (!strcmp(arg, "-u") || !strcmp(arg, "--unmerged")) {
 			/* There's no point in showing unmerged unless
 			 * you also show the stage information.



-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply related

* [PATCH] Do not ever list empty directories in git-ls-files --others
From: Petr Baudis @ 2006-03-26 14:25 UTC (permalink / raw)
  To: junkio, Jim MacBaine; +Cc: git
In-Reply-To: <3afbacad0602270643k9fdd255w8f3769ad77c54e65@mail.gmail.com>

  Hi,

Dear diary, on Mon, Feb 27, 2006 at 03:43:32PM CET, I got a letter
where Jim MacBaine <jmacbaine@gmail.com> said that...
> Many packages put empty directories under /etc, and although only a
> few of those directories are actually needed, the automatic removal of
> those packages will fail if I remove the empty directories manually.  
> Equally, the removal will fail, if I put a .placeholder file into
> those direrectories and cg-add it.  Is there a simple way out?

  this is caused by git-ls-files behaviour - we now call it with
the --directory argument which is nice since it will show a non-empty
unknown directory as a single entry and won't list all its contents.
What is not so nice is the side-effect you are describing, and I tend
to agree that if the directory is empty, it should not be listed.

---

Without the --directory flag, git-ls-files wouldn't ever list directories,
producing no output for empty directories, which is good since they cannot
be added and they bear no content, even untracked one (if Git ever starts
tracking directories on their own, this should obviously change since the
content notion will change).

With the --directory flag however, git-ls-files would list even empty
directories. This patch fixes this.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 ls-files.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ls-files.c b/ls-files.c
index e42119c..4502b51 100644
--- a/ls-files.c
+++ b/ls-files.c
@@ -258,11 +258,12 @@ static int dir_exists(const char *dirnam
  * Also, we ignore the name ".git" (even if it is not a directory).
  * That likely will not change.
  */
-static void read_directory(const char *path, const char *base, int baselen)
+static int read_directory(const char *path, const char *base, int baselen)
 {
-	DIR *dir = opendir(path);
+	DIR *fdir = opendir(path);
+	int contents = 0;
 
-	if (dir) {
+	if (fdir) {
 		int exclude_stk;
 		struct dirent *de;
 		char fullname[MAXPATHLEN + 1];
@@ -270,7 +271,7 @@ static void read_directory(const char *p
 
 		exclude_stk = push_exclude_per_directory(base, baselen);
 
-		while ((de = readdir(dir)) != NULL) {
+		while ((de = readdir(fdir)) != NULL) {
 			int len;
 
 			if ((de->d_name[0] == '.') &&
@@ -288,6 +289,7 @@ static void read_directory(const char *p
 
 			switch (DTYPE(de)) {
 			struct stat st;
+			int subdir, rewind_base;
 			default:
 				continue;
 			case DT_UNKNOWN:
@@ -301,22 +303,31 @@ static void read_directory(const char *p
 			case DT_DIR:
 				memcpy(fullname + baselen + len, "/", 2);
 				len++;
-				if (show_other_directories &&
-				    !dir_exists(fullname, baselen + len))
+				rewind_base = nr_dir;
+				subdir = read_directory(fullname, fullname,
+				                        baselen + len);
+				if (show_other_directories && subdir &&
+				    !dir_exists(fullname, baselen + len)) {
+					// Rewind the read subdirectory
+					while (nr_dir > rewind_base)
+						free(dir[--nr_dir]);
 					break;
-				read_directory(fullname, fullname,
-					       baselen + len);
+				}
+				contents += subdir;
 				continue;
 			case DT_REG:
 			case DT_LNK:
 				break;
 			}
 			add_name(fullname, baselen + len);
+			contents++;
 		}
-		closedir(dir);
+		closedir(fdir);
 
 		pop_exclude_per_directory(exclude_stk);
 	}
+
+	return contents;
 }
 
 static int cmp_name(const void *p1, const void *p2)


-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply related

* Re: History rewriting swiss army knife
From: Petr Baudis @ 2006-03-26 13:17 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vek0rzchc.fsf@assigned-by-dhcp.cox.net>

Dear diary, on Fri, Mar 24, 2006 at 11:47:43PM CET, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
> 
> >   It's never been so easy before - I've written cg-admin-rewritehist,
> > which will execute your filters for each commit (which can rewrite the
> > tree contents, just the tree itself through the index, committer/author
> > information and commit message) while the script will obviously preserve
> > all the other information like merges, author/committer information etc.
> 
> Hmph.  The above description sounds like you are not allowing
> the user's custom script to drop existing parent (or graft a new
> one) while rewriting.  I have not looked at how you are
> interfacing with user's custom script, but I sort-of expected
> you to throw a commit at it from older to newer (i.e. topo-order
> in reverse), along with the names of already re-written commit
> objects that are parents of taht commit, and have it build a
> rewritten commit and report its object name back to you.

There are rather several "filters" (user scripts) which are called at
various stages of the commit rewrite. In sum they are doing the same
thing as the single user script would, but cg-admin-rewritehist will
prepare some things to you so that everyone does not have to write the
common stuff again and again.

The net flexibility loss was zero, except two things:

* The parents list construction was hardcoded. Now I added a parent
  filter which gets the parent string on stdin (including the -p bits,
  but life's tough) and let it rewrite it (e.g. add stuff at the end).
  So to "etch a graft":

	cg-admin-rewritehist --parent-filter sed\ 's/^$/-p graftcommitid/' newbranch

  assuming single-root history; but you have current commit id in
  $GIT_COMMIT so you can go wild:

	cg-admin-rewritehist --parent-filter 'cat; [ "$GIT_COMMIT" = "COMMIT" ] && echo "-p GRAFTCOMMIT"' newbranch

* A new commit would be always created. Sometimes you might want to
  omit some commits. Now I added a commit filter which would be
  called instead of the git-commit-tree command.

  To remove commits authored by "Darl McBribe" from the history:

	cg-admin-rewritehist --commit-filter '
		if [ "$GIT_AUTHOR_NAME" = "Darl McBribe" ]; then
			shift
			while [ -n "$1" ]; do
				shift; echo "$1"; shift
			done
		else
			git-commit-tree "$@"
		fi' newbranch

  (note that this will handle even Darl's merges).

Thanks for the inspiration,

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* Re: [PATCH] Add git-explode-packs
From: Jan-Benedict Glaw @ 2006-03-26 12:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Martin Atukunda, git
In-Reply-To: <7vwtehpwdd.fsf@assigned-by-dhcp.cox.net>

[-- Attachment #1: Type: text/plain, Size: 1174 bytes --]

On Sat, 2006-03-25 22:12:46 -0800, Junio C Hamano <junkio@cox.net> wrote:
> Martin Atukunda <matlads@dsmagic.com> writes:
> > This script does the opposite of git repack -a -d.
> 
> The script seems to do what it claims to, but now why would one
> need to use this?  In other words what's the situation one would
> find this useful?

It's possibly useful if you oftenly access old objects with
git-cat-file or git-ls-tree.

Not being a Perl hacker, a friend and I eg. started to hack GIT
support into LXR. I've just posted some very early patches on the LXR
mailing list
(http://sourceforge.net/mailarchive/forum.php?forum_id=1734). What
would be even more interesting is to not unpack _all_ objects, but
only those belonging to specifically mentioned commits or tags. I
think LXR could make _good_ use of that.

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: Use a *real* built-in diff generator
From: Ralf Baechle @ 2006-03-26 11:09 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Davide Libenzi, Morten Welinder, Junio C Hamano, Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0603251030340.15714@g5.osdl.org>

On Sat, Mar 25, 2006 at 10:39:03AM -0800, Linus Torvalds wrote:

> Besides, I hate how GNU patch bends over backwards in applying crap that 
> isn't a proper patch at all (whitespace-corruption, you name it: GNU patch 
> will accept it). Also, I made "git-apply" be all-or-nothing: either it 
> applies the _whole_ patch (across many different files) or it applies none 
> of it. With GNU patch, if you get an error on the fifth file, the four 
> first files have been modified already - aarrgghhh..

Which is apply's greatest strength - and weakness.  GNU diff doesn't
understand the file renamings bits of git diffs, so they they need to be
used with apply.  So if a patch doesn't apply?  Apply doesn't even have
an option to apply things as good as it can and leave the rest in
reject files.  Yuck.

  Ralf

^ permalink raw reply

* Re: Following renames
From: Petr Baudis @ 2006-03-26 10:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <20060326105248.GG18185@pasky.or.cz>

Dear diary, on Sun, Mar 26, 2006 at 12:52:48PM CEST, I got a letter
where Petr Baudis <pasky@suse.cz> said that...
> Well, noone argues that rename tracking cures all the woes of hackerkind
                                                                ^^^^^^^^^^

Or is it hackerdom?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* Re: Following renames
From: Petr Baudis @ 2006-03-26 10:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7virq1sywj.fsf@assigned-by-dhcp.cox.net>

(Note that I do *not* want to raise the explicit vs. implicit rename
tracking argument, in case anyone would misunderstood. I've accepted
implicit rename tracking as a fact of Git life for now. I just want to
make use of it now. ;-)

Dear diary, on Sun, Mar 26, 2006 at 04:49:48AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Looking at the evolution of rev-list.c file itself was a good
> exercise to realize that rename tracking (more specifically,
> having whatchanged to follow renames) is not such a useful
> thing (at least for me).

Well, noone argues that rename tracking cures all the woes of hackerkind
and anything more precise than that is useless. I'm rather saying that
rename tracking indeed _is_ a special case of something more general and
truly very interesting, but a special case so frequent that it's worth
doing even if we can't do the general case yet. Or at least people
*think* it's very frequent and it gives them the warm fuzzy feeling
knowing that the tool can handle it (at least somehow) - and the warm
fuzzy feeling is important, especially if you're trusting your sources
to the tool.

So, obviously, you'll find plenty of counter-examples where rename
detection won't help. I don't argue that. I merely say that there will
still be enough cases where following renames will help to warrant
doing it.

Now, Git history has enough examples of where rename following would be
useful. When I'm digging into the history, I'm hitting the big tools
rename barrier all the time, and just yesterday when wondering about
jdl's <snap> removal from git.txt I've hit 2cf565c53 - coming along any
file to that commit should make me follow Documentation/core-git.txt out
of the commit (well, that's rather copy than rename detection).

> Another example.  Today's tar-tree updates have one interesting
> function I think should belong to strbuf.c, and before merging
> it to the mainline, I may move that function from tar-tree.c to
> strbuf.c.  After that happens, if I run "whatchanged strbuf.c"
> to see where that function came from, I would want it to notice
> it came from tar-tree.c, although it is not a rename at all.
> Just one function moved from a file to another.

A wild pickaxe - when the string disappears from file X, scan all the
changes in the commit and start following files where it reappears. This
should help, right?

But when you want to implement this, you hit the exact same problems as
when you try to follow renames, only a different part of diffcore
detects it. So, what I'm trying to solve is actually not just following
renames but a more general problem.

> If a file A and file B were cleaned up and merged into a single file
> C, which is in the tip of the tree, which one you would want
> whatchanged to switch following depends on which part of the C you
> were interested in.

If in doubt (and the user does not use pickaxe to clarify it), you can
just follow both. The user will get some extra stuff (or maybe even not
if he wants to know about pieces from both), but we are at least trying
to be useful and DTRT instead of doing nothing in case we would by any
chance not do the very best.

> Unless you are interested in the _entire_ contents of the file,
> that is.  Then tracking or even recording renames becomes
> useful, but that is a special case.

A frequent (and wanted) special case.

> That is the reason I am not so enthused about recording renames.
> I think the time is better spent on enhancing what pickaxe tries
> to do (currently it does very little), which I hinted in a
> separate message late last night.

Sure, pickaxe is cool, but as I said above, if you try to teach _it_
following around files, you'll hit the exact same problems as me. We're
just trying to build something using lego blocks with different stuff
inside but otherwise actually looking pretty much the same.

The thing with pickaxe is that frequently it would be simply more
laborous to dig for and construct the proper pickaxe string than just
firing up cg-log -s filename with greedy renames following and quickly
scanning through the results.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* Re: Following renames
From: Fredrik Kuivinen @ 2006-03-26 10:34 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Linus Torvalds, Ryan Anderson, git
In-Reply-To: <20060326100717.GD18185@pasky.or.cz>

On Sun, Mar 26, 2006 at 12:07:17PM +0200, Petr Baudis wrote:
> Dear diary, on Sun, Mar 26, 2006 at 05:19:50AM CEST, I got a letter
> where Linus Torvalds <torvalds@osdl.org> said that...
> > On Sun, 26 Mar 2006, Petr Baudis wrote:
> > > 
> > >   In [1], Linus suggests a non-core solution. Unfortunately, it doesn't
> > > fly - it requires at least two git-ls-tree calls per revision which
> > > would bog things down awfully (to roughly half of the original speed).
> > 
> > No it doesn't. It requires one git-ls-tree WHEN SOMETHING IS RENAMED.
> > 
> > In other words, basically never.
> 
> Huh? I don't see that now (and caps don't help me see it better). That's
> certainly not what is in [1], and I don't see _how_ to detect the
> renames in this case, and what would I be actually doing git-ls-tree for
> when I've already detected the rename. Based on [1], I'd be doing
> git-ls-tree merely to detect that a file _disappeared_ in the first
> place, I have to do other stuff to detect the renames themselves.
> 
> Dear diary, on Sun, Mar 26, 2006 at 09:35:02AM CEST, I got a letter
> where Ryan Anderson <ryan@michonline.com> said that...
> > A simple example is the first loop in git-annotate.perl.  (Which was
> > basically written by Linus, I just translated it from a
> > shell/pseudo-code example into Perl)
> 
> Thanks for the hint. Unfortunately, this is precisely the thing I want
> to avoid, that is essentially reimplementing part of git-rev-list - to
> do something good, I would have to do my own toposort and merge by date
> between parallel lines. OTOH, I might just construct a large revlist
> commandline specifying all the segments I'm interested in and see what
> happens when I run that.
> 
> Besides, doing it in shell would be pretty ugly job (forcing me to
> finally rewrite it in perl is not a bad thing but that'd be a somewhat
> larger project since I share various common routines with other cg
> tools, etc).
> 

If you decide to modify rev-list to do rename tracking you might want
to have a look at how this is done in blame.c. git-blame only tracks
one file (since that is what it needs) but I think it should be
possible to track multiple files with a similar approach.

- Fredrik

^ permalink raw reply

* Union diff
From: Petr Baudis @ 2006-03-26 10:21 UTC (permalink / raw)
  To: git

  Hello,

  sorry for possibly a silly question, but can I get a diff of a merge
commit with _union_ of changes against all the parents?

	$ git-diff-tree --abbrev -r -m --pretty=raw badfc383b

	diff-tree badfc38... (from 1ee6c84...)
	tree 29d81f18912328df4f4104e9b9cc355424ced04d
	parent 1ee6c84efda742eda8b4b200491341125d8d9639
	parent 453b160f03c8c6d450879482f617412c257e5889
	author Petr Baudis <pasky@suse.cz> 1143328578 +0100
	committer Petr Baudis <xpasky@machine.or.cz> 1143328578 +0100

	    Merge with v0.17

	:100755 100755 743c19f... b05900d... M	Documentation/make-cogito-asciidoc
	:100644 100644 5896df7... 6f06c35... M	cg-Xlib

	diff-tree badfc38... (from 453b160...)
	tree 29d81f18912328df4f4104e9b9cc355424ced04d
	parent 1ee6c84efda742eda8b4b200491341125d8d9639
	parent 453b160f03c8c6d450879482f617412c257e5889
	author Petr Baudis <pasky@suse.cz> 1143328578 +0100
	committer Petr Baudis <xpasky@machine.or.cz> 1143328578 +0100

	    Merge with v0.17

	:100644 100644 24ce0a4... d540853... M	TODO
	:100755 100755 6005083... f7efa9d... M	cg-log

  I would like something like:

	diff-tree badfc38... (from parents)
	tree 29d81f18912328df4f4104e9b9cc355424ced04d
	parent 1ee6c84efda742eda8b4b200491341125d8d9639
	parent 453b160f03c8c6d450879482f617412c257e5889
	author Petr Baudis <pasky@suse.cz> 1143328578 +0100
	committer Petr Baudis <xpasky@machine.or.cz> 1143328578 +0100

	    Merge with v0.17

	:100755 100755 743c19f... b05900d... M	Documentation/make-cogito-asciidoc
	:100644 100644 24ce0a4... d540853... M	TODO
	:100644 100644 5896df7... 6f06c35... M	cg-Xlib
	:100755 100755 6005083... f7efa9d... M	cg-log

  Now, the -c option documentation says:

	  It shows the differences from each of the parents to the merge
	result simultaneously, instead of showing pairwise diff between
	a parent and the result one at a time, which '-m' option output
	does.

  This sounds as exactly what I want. Well, the only problem is that the
same diff command as above with -c option added produces no diff at all,
just the header and commit messages. Did I misunderstand the -c
description and does it do something different?

  Thanks,

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* Re: git-svn name
From: Petr Baudis @ 2006-03-26 10:10 UTC (permalink / raw)
  To: Eric Wong; +Cc: git, Gerrit Pape, Chris Wright
In-Reply-To: <20060326030425.GA6306@hand.yhbt.net>

Dear diary, on Sun, Mar 26, 2006 at 05:04:25AM CEST, I got a letter
where Eric Wong <normalperson@yhbt.net> said that...
> Would distro package maintainers also be willing to add my git-svn
> script to their git-svn binary packages when a new release of git is
> made, too?  It's quite different from git-svnimport (see
> contrib/git-svn/git-svn.txt for details).

I think the primary purpose of the packages separation are dependencies
- not to make the git package depend on svn and such. So I guess the
packagers won't have a problem adding your script to the git-svn package
(concerning SuSE, I won't at least).

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* Re: Following renames
From: Petr Baudis @ 2006-03-26 10:07 UTC (permalink / raw)
  To: Linus Torvalds, Ryan Anderson; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0603251919170.15714@g5.osdl.org>

Dear diary, on Sun, Mar 26, 2006 at 05:19:50AM CEST, I got a letter
where Linus Torvalds <torvalds@osdl.org> said that...
> On Sun, 26 Mar 2006, Petr Baudis wrote:
> > 
> >   In [1], Linus suggests a non-core solution. Unfortunately, it doesn't
> > fly - it requires at least two git-ls-tree calls per revision which
> > would bog things down awfully (to roughly half of the original speed).
> 
> No it doesn't. It requires one git-ls-tree WHEN SOMETHING IS RENAMED.
> 
> In other words, basically never.

Huh? I don't see that now (and caps don't help me see it better). That's
certainly not what is in [1], and I don't see _how_ to detect the
renames in this case, and what would I be actually doing git-ls-tree for
when I've already detected the rename. Based on [1], I'd be doing
git-ls-tree merely to detect that a file _disappeared_ in the first
place, I have to do other stuff to detect the renames themselves.

Dear diary, on Sun, Mar 26, 2006 at 09:35:02AM CEST, I got a letter
where Ryan Anderson <ryan@michonline.com> said that...
> A simple example is the first loop in git-annotate.perl.  (Which was
> basically written by Linus, I just translated it from a
> shell/pseudo-code example into Perl)

Thanks for the hint. Unfortunately, this is precisely the thing I want
to avoid, that is essentially reimplementing part of git-rev-list - to
do something good, I would have to do my own toposort and merge by date
between parallel lines. OTOH, I might just construct a large revlist
commandline specifying all the segments I'm interested in and see what
happens when I run that.

Besides, doing it in shell would be pretty ugly job (forcing me to
finally rewrite it in perl is not a bad thing but that'd be a somewhat
larger project since I share various common routines with other cg
tools, etc).

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox