From f8290630cb900fc5581e91a4cc055d2fba121db0 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sat, 18 Nov 2006 03:56:52 +0100 Subject: [PATCH 1/7] Fix git-for-each-refs broken for tags Unfortunately, git-for-each-refs is currently unusable for peeking into tag comments, since it uses freed pointers, so it just prints out all sort of garbage. This makes it strdup() contents and body values. Signed-off-by: Petr Baudis Signed-off-by: Junio C Hamano --- builtin-for-each-ref.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index 173bf38735..227aa3cd7f 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -478,9 +478,9 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct obj if (!strcmp(name, "subject")) v->s = copy_line(subpos); else if (!strcmp(name, "body")) - v->s = bodypos; + v->s = xstrdup(bodypos); else if (!strcmp(name, "contents")) - v->s = subpos; + v->s = xstrdup(subpos); } } From f847c07b9ac82ff3d0da0efb3bed75bc17489a17 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sat, 18 Nov 2006 06:05:11 +0100 Subject: [PATCH 2/7] git-apply: Documentation typo fix inacurate -> inaccurate, sorry if it was a pun. ;-) Signed-off-by: Petr Baudis Signed-off-by: Junio C Hamano --- Documentation/git-apply.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt index d9137c7489..2cc32d1c5e 100644 --- a/Documentation/git-apply.txt +++ b/Documentation/git-apply.txt @@ -150,7 +150,7 @@ discouraged. * `strip` outputs warnings for a few such errors, strips out the trailing whitespaces and applies the patch. ---inacurate-eof:: +--inaccurate-eof:: Under certain circumstances, some versions of diff do not correctly detect a missing new-line at the end of the file. As a result, patches created by such diff programs do not record incomplete lines From a6e8a7677055e092424db42c044774bc6dbd74f6 Mon Sep 17 00:00:00 2001 From: Rene Scharfe Date: Sat, 18 Nov 2006 13:07:06 +0100 Subject: [PATCH 3/7] sparse fix: non-ANSI function declaration The declaration of discard_cache() in cache.h already has its "void". Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- index-pack.c | 2 +- read-cache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index-pack.c b/index-pack.c index 042aea8842..8331d99a62 100644 --- a/index-pack.c +++ b/index-pack.c @@ -90,7 +90,7 @@ static SHA_CTX input_ctx; static int input_fd, output_fd, mmap_fd; /* Discard current buffer used content. */ -static void flush() +static void flush(void) { if (input_offset) { if (output_fd >= 0) diff --git a/read-cache.c b/read-cache.c index 97c38670b4..0f5fb5bc33 100644 --- a/read-cache.c +++ b/read-cache.c @@ -844,7 +844,7 @@ unmap: die("index file corrupt"); } -int discard_cache() +int discard_cache(void) { int ret; From 38f4d138ee101f3f238ffd43fac76f5b951516c1 Mon Sep 17 00:00:00 2001 From: Rene Scharfe Date: Sat, 18 Nov 2006 13:06:56 +0100 Subject: [PATCH 4/7] sparse fix: Using plain integer as NULL pointer Z_NULL is defined as 0, use a proper NULL pointer in its stead. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- archive-zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archive-zip.c b/archive-zip.c index 28e7352e98..ae5572ae20 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -160,7 +160,7 @@ static int write_zip_entry(const unsigned char *sha1, void *buffer = NULL; void *deflated = NULL; - crc = crc32(0, Z_NULL, 0); + crc = crc32(0, NULL, 0); path = construct_path(base, baselen, filename, S_ISDIR(mode), &pathlen); if (verbose) From 3dad11bfdb9363bade57ca2caadef1883767e9d3 Mon Sep 17 00:00:00 2001 From: Rene Scharfe Date: Sat, 18 Nov 2006 13:07:09 +0100 Subject: [PATCH 5/7] git-apply: slightly clean up bitfield usage This patch fixes a sparse warning about inaccurate_eof being a "dubious one-bit signed bitfield", makes three more binary variables members of this (now unsigned) bitfield and adds a short comment to indicate the nature of two ternary variables. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin-apply.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/builtin-apply.c b/builtin-apply.c index aad55261fa..61f047fd45 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -140,12 +140,15 @@ struct fragment { struct patch { char *new_name, *old_name, *def_name; unsigned int old_mode, new_mode; - int is_rename, is_copy, is_new, is_delete, is_binary; + int is_new, is_delete; /* -1 = unknown, 0 = false, 1 = true */ int rejected; unsigned long deflate_origlen; int lines_added, lines_deleted; int score; - int inaccurate_eof:1; + unsigned int inaccurate_eof:1; + unsigned int is_binary:1; + unsigned int is_copy:1; + unsigned int is_rename:1; struct fragment *fragments; char *result; unsigned long resultsize; From fd931411c0635ca5e7968bd2981457056b49062b Mon Sep 17 00:00:00 2001 From: Rene Scharfe Date: Sat, 18 Nov 2006 15:15:49 +0100 Subject: [PATCH 6/7] Document git-runstatus I copied most of the text from git-status.txt. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/git-runstatus.txt | 69 +++++++++++++++++++++++++++++++++ Documentation/git.txt | 3 ++ builtin-runstatus.c | 2 +- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 Documentation/git-runstatus.txt diff --git a/Documentation/git-runstatus.txt b/Documentation/git-runstatus.txt new file mode 100644 index 0000000000..89d7b92731 --- /dev/null +++ b/Documentation/git-runstatus.txt @@ -0,0 +1,69 @@ +git-runstatus(1) +================ + +NAME +---- +git-runstatus - A helper for git-status and git-commit + + +SYNOPSIS +-------- +'git-runstatus' [--color|--nocolor] [--amend] [--verbose] [--untracked] + + +DESCRIPTION +----------- +Examines paths in the working tree that has changes unrecorded +to the index file, and changes between the index file and the +current HEAD commit. The former paths are what you _could_ +commit by running 'git-update-index' before running 'git +commit', and the latter paths are what you _would_ commit by +running 'git commit'. + +If there is no path that is different between the index file and +the current HEAD commit, the command exits with non-zero status. + +Note that this is _not_ the user level command you would want to +run from the command line. Use 'git-status' instead. + + +OPTIONS +------- +--color:: + Show colored status, highlighting modified file names. + +--nocolor:: + Turn off coloring. + +--amend:: + Show status based on HEAD^1, not HEAD, i.e. show what + 'git-commit --amend' would do. + +--verbose:: + Show unified diff of all file changes. + +--untracked:: + Show files in untracked directories, too. Without this + option only its name and a trailing slash are displayed + for each untracked directory. + + +OUTPUT +------ +The output from this command is designed to be used as a commit +template comments, and all the output lines are prefixed with '#'. + + +Author +------ +Originally written by Linus Torvalds as part +of git-commit, and later rewritten in C by Jeff King. + +Documentation +-------------- +Documentation by David Greaves, Junio C Hamano and the git-list . + +GIT +--- +Part of the gitlink:git[7] suite + diff --git a/Documentation/git.txt b/Documentation/git.txt index 52bc05ad50..619d65685e 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -302,6 +302,9 @@ gitlink:git-request-pull[1]:: gitlink:git-rev-parse[1]:: Pick out and massage parameters. +gitlink:git-runstatus[1]:: + A helper for git-status and git-commit. + gitlink:git-send-email[1]:: Send patch e-mails out of "format-patch --mbox" output. diff --git a/builtin-runstatus.c b/builtin-runstatus.c index 303c556da0..0b63037dd0 100644 --- a/builtin-runstatus.c +++ b/builtin-runstatus.c @@ -4,7 +4,7 @@ extern int wt_status_use_color; static const char runstatus_usage[] = -"git-runstatus [--color|--nocolor] [--amend] [--verbose]"; +"git-runstatus [--color|--nocolor] [--amend] [--verbose] [--untracked]"; int cmd_runstatus(int argc, const char **argv, const char *prefix) { From e3d457fb59f71dd40d24c82f48625a24492907d4 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sat, 18 Nov 2006 20:44:08 +0100 Subject: [PATCH 7/7] Documentation: Define symref and update HEAD description HEAD was still described as a symlink instead of a symref. Signed-off-by: Petr Baudis Signed-off-by: Junio C Hamano --- Documentation/glossary.txt | 7 +++++++ Documentation/repository-layout.txt | 14 +++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Documentation/glossary.txt b/Documentation/glossary.txt index 7e560b0eea..894883d7b6 100644 --- a/Documentation/glossary.txt +++ b/Documentation/glossary.txt @@ -282,6 +282,13 @@ SCM:: SHA1:: Synonym for object name. +symref:: + Symbolic reference: instead of containing the SHA1 id itself, it + is of the format 'ref: refs/some/thing' and when referenced, it + recursively dereferences to this reference. 'HEAD' is a prime + example of a symref. Symbolic references are manipulated with + the gitlink:git-symbolic-ref[1] command. + topic branch:: A regular git branch that is used by a developer to identify a conceptual line of development. Since branches diff --git a/Documentation/repository-layout.txt b/Documentation/repository-layout.txt index 275d18bb54..6d8c58ed20 100644 --- a/Documentation/repository-layout.txt +++ b/Documentation/repository-layout.txt @@ -70,12 +70,16 @@ refs/tags/`name`:: object, or a tag object that points at a commit object). HEAD:: - A symlink of the form `refs/heads/'name'` to point at - the current branch, if exists. It does not mean much if - the repository is not associated with any working tree + A symref (see glossary) to the `refs/heads/` namespace + describing the currently active branch. It does not mean + much if the repository is not associated with any working tree (i.e. a 'bare' repository), but a valid git repository - *must* have such a symlink here. It is legal if the - named branch 'name' does not (yet) exist. + *must* have the HEAD file; some porcelains may use it to + guess the designated "default" branch of the repository + (usually 'master'). It is legal if the named branch + 'name' does not (yet) exist. In some legacy setups, it is + a symbolic link instead of a symref that points at the current + branch. branches:: A slightly deprecated way to store shorthands to be used