Add builtin git-last-modified.
Subsystems (2)
This is a plumbing command which can be used by gitweb. It will scan a list of commits and/or refs and return the time in seconds for the youngest commit. This value can then be used to generate and check the Last-Modified and Is-Modified-Since HTTP headers.
Signed-off-by Robert Fitzsimons <[email protected]>
---
The following two commands lines are similar:
$ git for-each-ref --count=1 --sort=-committerdate '--format=%(committerdate)' refs/heads $ git last-modified --branches
The last-modified version is a bit faster (5-10%).
I'm not 100% sure how this command and if this command should be used by gitweb. But I'll post the patch anyway for comments.
Robert
.gitignore | 1 + Documentation/git-last-modified.txt | 49 ++++++++++++++++++++++++++++ Makefile | 3 +- builtin-last-modified.c | 61 +++++++++++++++++++++++++++++++++++ builtin.h | 1 + git.c | 1 + t/t3810-last-modified.sh | 57 ++++++++++++++++++++++++++++++++ 7 files changed, 172 insertions(+), 1 deletions(-)
.gitignore +1 -0
@@ -58,6 +58,7 @@ git-lost-found git-ls-files git-ls-remote git-ls-tree +git-last-modified git-mailinfo git-mailsplit git-merge
Documentation/git-last-modified.txt new file +49 -0
49 lines not on this page · raw message
Makefile +2 -1
@@ -312,7 +312,8 @@ BUILTIN_OBJS = \ builtin-verify-pack.o \ builtin-write-tree.o \ builtin-show-ref.o \ - builtin-pack-refs.o + builtin-pack-refs.o \ + builtin-last-modified.o GITLIBS = $(LIB_FILE) $(XDIFF_LIB) EXTLIBS = -lz
builtin-last-modified.c new file +61 -0
61 lines not on this page · raw message
builtin.h +1 -0
@@ -75,5 +75,6 @@ extern int cmd_write_tree(int argc, const char **argv, const char *prefix);extern int cmd_verify_pack (int argc,const char **argv,const char *prefix);extern int cmd_show_ref (int argc,const char **argv,const char *prefix);extern int cmd_pack_refs (int argc,const char **argv,const char *prefix); +extern int cmd_last_modified (int argc,const char **argv,const char *prefix);#endif
git.c +1 -0
@@ -269,6 +269,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp) { "verify-pack", cmd_verify_pack }, { "show-ref", cmd_show_ref, RUN_SETUP }, { "pack-refs", cmd_pack_refs, RUN_SETUP }, + { "last-modified", cmd_last_modified, RUN_SETUP }, };int i;
t/t3810-last-modified.sh new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.5.0.rc0.g2708-dirty