* Regarding: git-lost+found @ 2005-11-08 17:13 Johannes Schindelin 2005-11-08 17:45 ` Petr Baudis 2005-11-09 21:25 ` Junio C Hamano 0 siblings, 2 replies; 9+ messages in thread From: Johannes Schindelin @ 2005-11-08 17:13 UTC (permalink / raw) To: git Hi, I think this is a valuable addition to the "Now what?" part of git. However, I'd like to see the results stored into .git/refs/lost+found/ rather than .git/lost+found/, so that it is possible to inspect them easily with gitk or git-show-branch. Just my sue tents, Dscho ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Regarding: git-lost+found 2005-11-08 17:13 Regarding: git-lost+found Johannes Schindelin @ 2005-11-08 17:45 ` Petr Baudis 2005-11-08 17:48 ` Petr Baudis 2005-11-09 21:25 ` Junio C Hamano 1 sibling, 1 reply; 9+ messages in thread From: Petr Baudis @ 2005-11-08 17:45 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git Dear diary, on Tue, Nov 08, 2005 at 06:13:06PM CET, I got a letter where Johannes Schindelin <Johannes.Schindelin@gmx.de> told me that... > I think this is a valuable addition to the "Now what?" part of git. > However, I'd like to see the results stored into .git/refs/lost+found/ > rather than .git/lost+found/, so that it is possible to inspect them > easily with gitk or git-show-branch. What is it supposed to be? -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ VI has two modes: the one in which it beeps and the one in which it doesn't. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Regarding: git-lost+found 2005-11-08 17:45 ` Petr Baudis @ 2005-11-08 17:48 ` Petr Baudis 0 siblings, 0 replies; 9+ messages in thread From: Petr Baudis @ 2005-11-08 17:48 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git > > I think this is a valuable addition to the "Now what?" part of git. > > However, I'd like to see the results stored into .git/refs/lost+found/ > > rather than .git/lost+found/, so that it is possible to inspect them > > easily with gitk or git-show-branch. > > What is it supposed to be? Sorry for the noise - /lost.found/ found some matches (see the "what after 0.98" mail from Junio). (Still, it would be helpful to put a reference to your mail.) -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ VI has two modes: the one in which it beeps and the one in which it doesn't. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Regarding: git-lost+found 2005-11-08 17:13 Regarding: git-lost+found Johannes Schindelin 2005-11-08 17:45 ` Petr Baudis @ 2005-11-09 21:25 ` Junio C Hamano 2005-11-09 23:06 ` Daniel Barkalow 2005-11-14 4:36 ` Matthias Urlichs 1 sibling, 2 replies; 9+ messages in thread From: Junio C Hamano @ 2005-11-09 21:25 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > I think this is a valuable addition to the "Now what?" part of git. > However, I'd like to see the results stored into .git/refs/lost+found/ > rather than .git/lost+found/, so that it is possible to inspect them > easily with gitk or git-show-branch. I've thought about it, but on the other hand, having them under refs/ hierarchy means fsck-objects would think they are relevant and prune would never be able to remove them anymore. The scenario that git-lost+found would be useful is after you did 'git branch -D', 'git tag -d', or 'git tag -f' and removed something you did not mean to by accident. You would find what you want with git-lost+found and perhaps with help from gitk, and then reconnect them. At that point, it is very likely that you would forget to clean the remainder afterwards. Later, you probably forget you have ever run git-lost+found, and would start wondering why git-prune would not remove any leftover anymore. Maybe we could use .git/lost+found/{commit,other}/?{40} and hang committish under one directory and the rest in another? Then we could do this: $ gitk $(cd .git/lost+found/commit && echo ??*) After you find what you want, you would do 'git tag' or 'git branch' to reconnect them, but we can reasonably expect that is to happen soon after you ran lost+found and before the next time you run prune, because that was why you ran git-lost+found in the first place. Prune will remove the objects reachable only from lost+found, so the above gitk command line would fail if run after you did git-lost+found and then git-prune in this order, but that is an unlikely sequence. So, based on the above reasoning, how about this one? -- >8 -- cut here -- >8 -- [PATCH] lost+found: make it a bit more useful with gitk This separates the committish from others when resurrecting dangling objects to .git/lost+found/ hierarchy. After running git-lost+found command, you could: $ gitk $(cd .git/lost+found/commit && echo ??*) to see how these branches came about from known old tags. --- diff --git a/git-lost+found.sh b/git-lost+found.sh index bc1e988..b6b2616 100755 --- a/git-lost+found.sh +++ b/git-lost+found.sh @@ -3,18 +3,21 @@ . git-sh-setup || die "Not a git archive." laf="$GIT_DIR/lost+found" -mkdir -p "$laf" || exit +rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit git fsck-objects | while read dangling type sha1 do case "$dangling" in dangling) - echo "$sha1" >"$laf/$sha1" - case "$type" in - commit | tag) - git-show-branch "$sha1" ;; - esac + if git-rev-parse --verify "$sha1^0" >/dev/null 2>/dev/null + then + dir="$laf/commit" + git-show-branch "$sha1" + else + dir="$laf/other" + fi + echo "$sha1" >"$dir/$sha1" ;; esac done ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Regarding: git-lost+found 2005-11-09 21:25 ` Junio C Hamano @ 2005-11-09 23:06 ` Daniel Barkalow 2005-11-09 23:23 ` Junio C Hamano 2005-11-14 4:36 ` Matthias Urlichs 1 sibling, 1 reply; 9+ messages in thread From: Daniel Barkalow @ 2005-11-09 23:06 UTC (permalink / raw) To: Junio C Hamano; +Cc: Johannes Schindelin, git On Wed, 9 Nov 2005, Junio C Hamano wrote: > Maybe we could use .git/lost+found/{commit,other}/?{40} and hang > committish under one directory and the rest in another? Then we > could do this: > > $ gitk $(cd .git/lost+found/commit && echo ??*) > > After you find what you want, you would do 'git tag' or 'git > branch' to reconnect them, but we can reasonably expect that is > to happen soon after you ran lost+found and before the next time > you run prune, because that was why you ran git-lost+found in > the first place. Why have git-lost+found write to files at all? It seems to me easiest to have the list go to standard out, and you could do "gitk `git-lost+found -t commit`" to see lost commits, and reconnect them as desired. (Making up command line syntax for listing only the commits.) -Daniel *This .sig left intentionally blank* ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Regarding: git-lost+found 2005-11-09 23:06 ` Daniel Barkalow @ 2005-11-09 23:23 ` Junio C Hamano 2005-11-10 0:29 ` Daniel Barkalow 0 siblings, 1 reply; 9+ messages in thread From: Junio C Hamano @ 2005-11-09 23:23 UTC (permalink / raw) To: Daniel Barkalow; +Cc: git Daniel Barkalow <barkalow@iabervon.org> writes: > Why have git-lost+found write to files at all? It seems to me easiest to > have the list go to standard out, and you could do "gitk `git-lost+found > -t commit`" to see lost commits, and reconnect them as desired. (Making up > command line syntax for listing only the commits.) That is certainly cleaner. The only downside is fsck-objects that lost+found uses tends to be expensive operation, and what you would want to do with the information may be more than just use it on the command line of gitk. But in any case the user could store git-lost+found output in a file to do whatever she wants, so it may not matter. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Regarding: git-lost+found 2005-11-09 23:23 ` Junio C Hamano @ 2005-11-10 0:29 ` Daniel Barkalow 0 siblings, 0 replies; 9+ messages in thread From: Daniel Barkalow @ 2005-11-10 0:29 UTC (permalink / raw) To: Junio C Hamano; +Cc: git On Wed, 9 Nov 2005, Junio C Hamano wrote: > Daniel Barkalow <barkalow@iabervon.org> writes: > > > Why have git-lost+found write to files at all? It seems to me easiest to > > have the list go to standard out, and you could do "gitk `git-lost+found > > -t commit`" to see lost commits, and reconnect them as desired. (Making up > > command line syntax for listing only the commits.) > > That is certainly cleaner. The only downside is fsck-objects > that lost+found uses tends to be expensive operation, and what > you would want to do with the information may be more than just > use it on the command line of gitk. But in any case the user > could store git-lost+found output in a file to do whatever she > wants, so it may not matter. Actually, my next suggestion would be to have gitk able to write hashes as refs, so that, having put it on the gitk command line, you could then do the things you want from there. -Daniel *This .sig left intentionally blank* ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Regarding: git-lost+found 2005-11-09 21:25 ` Junio C Hamano 2005-11-09 23:06 ` Daniel Barkalow @ 2005-11-14 4:36 ` Matthias Urlichs 2005-11-14 18:01 ` Fix git-rev-list "date order" with --topo-order Linus Torvalds 1 sibling, 1 reply; 9+ messages in thread From: Matthias Urlichs @ 2005-11-14 4:36 UTC (permalink / raw) To: git Hi, Junio C Hamano wrote: > $ gitk $(cd .git/lost+found/commit && echo ??*) Along those lines... I just tried that, it found a whole heap of old commits I didn't yet clean up, and they're sorted by their SHA1. In other words, actually finding the latest commit in there was a nontrivial task. I don't speak tcl, so could somebody please change "gitk -d" to sort its command line by date (newest first, of course)? Thanks. -- Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de - - Innocence ends when one is stripped of the delusion that one likes oneself. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Fix git-rev-list "date order" with --topo-order 2005-11-14 4:36 ` Matthias Urlichs @ 2005-11-14 18:01 ` Linus Torvalds 0 siblings, 0 replies; 9+ messages in thread From: Linus Torvalds @ 2005-11-14 18:01 UTC (permalink / raw) To: Matthias Urlichs, Junio C Hamano; +Cc: Git Mailing List This fixes git-rev-list so that when there are multiple branches, we still sort the heads in proper approximate date order even when sorting the output topologically. This makes things like gitk --all -d work sanely and show the branches in date order (where "date order" is obviously modified by the paren-child dependency requirements of the topological sort). The trivial fix is to just build the "work" list in date order rather than inserting the new work entries at the beginning. Signed-off-by: Linus Torvalds <torvalds@osdl.org> --- This should also fix this report, although Matthias should double-test.. On Mon, 14 Nov 2005, Matthias Urlichs wrote: > > > $ gitk $(cd .git/lost+found/commit && echo ??*) > > Along those lines... I just tried that, it found a whole heap of old > commits I didn't yet clean up, and they're sorted by their SHA1. > > In other words, actually finding the latest commit in there was a > nontrivial task. > > I don't speak tcl, so could somebody please change "gitk -d" to sort its > command line by date (newest first, of course)? Thanks. diff --git a/commit.c b/commit.c index 534c03e..ebf4db6 100644 --- a/commit.c +++ b/commit.c @@ -536,7 +536,7 @@ int count_parents(struct commit * commit void sort_in_topological_order(struct commit_list ** list) { struct commit_list * next = *list; - struct commit_list * work = NULL; + struct commit_list * work = NULL, **insert; struct commit_list ** pptr = list; struct sort_node * nodes; struct sort_node * next_nodes; @@ -580,11 +580,12 @@ void sort_in_topological_order(struct co * the tips serve as a starting set for the work queue. */ next=*list; + insert = &work; while (next) { struct sort_node * node = (struct sort_node *)next->item->object.util; if (node->indegree == 0) { - commit_list_insert(next->item, &work); + insert = &commit_list_insert(next->item, insert)->next; } next=next->next; } ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-11-14 18:02 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-11-08 17:13 Regarding: git-lost+found Johannes Schindelin 2005-11-08 17:45 ` Petr Baudis 2005-11-08 17:48 ` Petr Baudis 2005-11-09 21:25 ` Junio C Hamano 2005-11-09 23:06 ` Daniel Barkalow 2005-11-09 23:23 ` Junio C Hamano 2005-11-10 0:29 ` Daniel Barkalow 2005-11-14 4:36 ` Matthias Urlichs 2005-11-14 18:01 ` Fix git-rev-list "date order" with --topo-order Linus Torvalds
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).