Commit graph

13 commits

Author SHA1 Message Date
Linus Torvalds cf39f54efc git reflog show
It makes "git reflog [show]" act as

	git log -g --pretty=oneline --abbrev-cmit

and is fairly straightforward. So you can just write

	git reflog

or

	git reflog show

and it will show you the reflog in a nice format.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-08 15:35:24 -08:00
Nicolas Pitre eb8381c885 scan reflogs independently from refs
Currently, the search for all reflogs depends on the existence of
corresponding refs under the .git/refs/ directory.  Let's scan the
.git/logs/ directory directly instead.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 11:57:18 -08:00
Nicolas Pitre 9a13f0b71b make reflog filename independent from struct ref_lock
This allows for ref_log_write() to be used in a more flexible way,
and is needed for future changes.

This is only code reorg with no behavior change.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 02:16:46 -08:00
Junio C Hamano c9a8992569 reflog gc: a tag that does not point at a commit is not a crime.
Although unusual, tags can point at any object.  Warning only
once is fine, but warning every time about the same tag gets
annoying.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 21:39:03 -08:00
Junio C Hamano 15261e3b33 git reflog expire: document --stale-fix option.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-15 14:43:03 -08:00
Junio C Hamano 9bbaa6cc68 reflog-expire: brown paper bag fix.
When --stale-fix is not passed, the code did not initialize the
two commit objects properly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-11 19:56:43 -08:00
Johannes Schindelin 883d60fa97 Sanitize for_each_reflog_ent()
It used to ignore the return value of the helper function; now, it
expects it to return 0, and stops iteration upon non-zero return
values; this value is then passed on as the return value of
for_each_reflog_ent().

Further, it makes no sense to force the parsing upon the helper
functions; for_each_reflog_ent() now calls the helper function with
old and new sha1, the email, the timestamp & timezone, and the message.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 03:04:04 -08:00
Junio C Hamano cd1f9c36be reflog --fix-stale: do not check the same trees and commits repeatedly.
Since we use the reachability tracking machinery now, we should
keep the already checked trees and commits whose completeness is
known, to avoid checking the same thing over and over again.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:34 -08:00
Junio C Hamano 1389d9ddaa reflog expire --fix-stale
The logic in an earlier round to detect reflog entries that
point at a broken commit was not sufficient.  Just like we do
not trust presense of a commit during pack transfer (we trust
only our refs), we should not trust a commit's presense, even if
the tree of that commit is complete.

A repository that had reflog enabled on some of the refs that
was rewound and then run git-repack or git-prune from older
versions of git can have reflog entries that point at a commit
that still exist but lack commits (or trees and blobs needed for
that commit) between it and some commit that is reachable from
one of the refs.

This revamps the logic -- the definition of "broken commit"
becomes: a commit that is not reachable from any of the refs and
there is a missing object among the commit, tree, or blob
objects reachable from it that is not reachable from any of the
refs.  Entries in the reflog that refer to such a commit are
expired.

Since this computation involves traversing all the reachable
objects, i.e. it has the same cost as 'git prune', it is enabled
only when a new option --fix-stale.  Fortunately, once this is
run, we should not have to ever worry about missing objects,
because the current prune and pack-objects know about reflogs
and protect objects referred by them.

Unfortunately, this will be absolutely necessary to help people
migrate to the newer prune and repack.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:34 -08:00
Junio C Hamano 4aec56d12b git-reflog: gc.* configuration and documentation.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-27 01:47:57 -08:00
Junio C Hamano 58748293f6 reflog expire: do not punt on tags that point at non commits.
It is unusual for a tag to point at a non-commit, and it is also
unusual for a tag to have reflog, but that is not an error and
we should still prune its reflog entries just as other refs.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 23:42:30 -08:00
Junio C Hamano 8d8b9f6252 reflog expire: prune commits that are not incomplete
Older fsck-objects and prune did not protect commits in reflog
entries, and it is quite possible that a commit still exists in
the repository (because it was in a pack, or something) while
some of its trees and blobs are long gone.  Make sure the commit
and its associated tree is complete and expire incomplete ones.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 00:46:33 -08:00
Junio C Hamano 4264dc15e1 git reflog expire
This prepares a place to collect reflog management subcommands,
and implements "expire" action.

	$ git reflog expire --dry-run \
		--expire=4.weeks \
		--expire-unreachable=1.week \
		refs/heads/master

The expiration uses two timestamps: --expire and --expire-unreachable.
Entries older than expire time (defaults to 90 days), and entries older
than expire-unreachable time (defaults to 30 days) and records a commit
that has been rewound and made unreachable from the current tip of the
ref are removed from the reflog.

The parameter handling is still rough, but I think the
core logic for expiration is already sound.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-20 17:22:10 -08:00