aboutsummaryrefslogtreecommitdiff
path: root/builtin-tag.c
Commit message (Collapse)AuthorAge
* git-tag: Add --contains optionJake Goulding2009-01-28
| | | | | | | | | | This functions similarly to "git branch --contains"; it will show all tags that contain the specified commit, by sharing the same logic. The patch also adds documentation and tests for the new option. Signed-off-by: Jake Goulding <goulding@vivisimo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint'Junio C Hamano2008-12-07
|\ | | | | | | | | | | | | | | | | | | * maint: GIT 1.6.0.5 "git diff <tree>{3,}": do not reverse order of arguments tag: delete TAG_EDITMSG only on successful tag gitweb: Make project specific override for 'grep' feature work http.c: use 'git_config_string' to get 'curl_http_proxy' fetch-pack: Avoid memcpy() with src==dst
| * tag: delete TAG_EDITMSG only on successful tagJeff King2008-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The user may put some effort into writing an annotated tag message. When the tagging process later fails (which can happen fairly easily, since it may be dependent on gpg being correctly configured and used), there is no record left on disk of the tag message. Instead, let's keep the TAG_EDITMSG file around until we are sure the tag has been created successfully. If we die because of an error, the user can recover their text from that file. Leaving the file in place causes no conflicts; it will be silently overwritten by the next annotated tag creation. This matches the behavior of COMMIT_EDITMSG, which stays around in case of error. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Merge branch 'st/maint-tag' into maintJunio C Hamano2008-11-30
| |\ | | | | | | | | | | | | | | | * st/maint-tag: tag: Add more tests about mixing incompatible modes and options tag: Check that options are only allowed in the appropriate mode
| * \ Merge branch 'ar/maint-mksnpath' into maintJunio C Hamano2008-11-08
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ar/maint-mksnpath: Use git_pathdup instead of xstrdup(git_path(...)) git_pathdup: returns xstrdup-ed copy of the formatted path Fix potentially dangerous use of git_path in ref.c Add git_snpath: a .git path formatting routine with output buffer Fix potentially dangerous uses of mkpath and git_path Fix mkpath abuse in dwim_ref and dwim_log of sha1_name.c Add mksnpath which allows you to specify the output buffer Conflicts: builtin-revert.c rerere.c
* | \ \ Merge branch 'st/tag'Junio C Hamano2008-11-12
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | | | | | * st/tag: tag: Add more tests about mixing incompatible modes and options tag: Check that options are only allowed in the appropriate mode
| * | | tag: Check that options are only allowed in the appropriate modeSamuel Tardieu2008-11-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If "git tag -d -l -v ..." is called, only "-l" is honored, which is arbitrary and wrong. Also, unrecognized options are accepted in the wrong modes, causing for example "git tag -n 100" to create a tag named "100" while the user may have wanted to type "git tag -n100". This patch checks that "git tag" knows in what mode it operates before performing any operation and accepts only the related options. Signed-off-by: Samuel Tardieu <sam@rfc1149.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'ar/mksnpath'Junio C Hamano2008-11-05
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ar/mksnpath: Use git_pathdup instead of xstrdup(git_path(...)) git_pathdup: returns xstrdup-ed copy of the formatted path Fix potentially dangerous use of git_path in ref.c Add git_snpath: a .git path formatting routine with output buffer Fix potentially dangerous uses of mkpath and git_path Fix potentially dangerous uses of mkpath and git_path Fix mkpath abuse in dwim_ref and dwim_log of sha1_name.c Add mksnpath which allows you to specify the output buffer Conflicts: builtin-revert.c
| * \ \ \ Merge branch 'ar/maint-mksnpath' into ar/mksnpathJunio C Hamano2008-10-30
| |\ \ \ \ | | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ar/maint-mksnpath: Use git_pathdup instead of xstrdup(git_path(...)) git_pathdup: returns xstrdup-ed copy of the formatted path Fix potentially dangerous use of git_path in ref.c Add git_snpath: a .git path formatting routine with output buffer Conflicts: builtin-revert.c refs.c rerere.c
| | * | | Use git_pathdup instead of xstrdup(git_path(...))Alex Riesen2008-10-30
| | |/ / | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'mv/maint-branch-m-symref'Junio C Hamano2008-11-05
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| | | | | | | | | | | | | * mv/maint-branch-m-symref: update-ref --no-deref -d: handle the case when the pointed ref is packed git branch -m: forbid renaming of a symref Fix git update-ref --no-deref -d. rename_ref(): handle the case when the reflog of a ref does not exist Fix git branch -m for symrefs.
| * | Fix git branch -m for symrefs.Miklos Vajna2008-10-26
| |/ | | | | | | | | | | | | | | | | | | | | | | | | This had two problems with symrefs. First, it copied the actual sha1 instead of the "pointer", second it failed to remove the old ref after a successful rename. Given that till now delete_ref() always dereferenced symrefs, a new parameters has been introduced to delete_ref() to allow deleting refs without a dereference. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerBrandon Casey2008-10-12
|/ | | | | | | | | | | Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Sync with 1.5.6.5Junio C Hamano2008-08-06
|\
| * Files given on the command line are relative to $cwdJunio C Hamano2008-08-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running "git commit -F file" and "git tag -F file" from a subdirectory, we should take it as relative to the directory we started from, not relative to the top-level directory. This adds a helper function "parse_options_fix_filename()" to make it more convenient to fix this class of issues. Ideally, parse_options() should support a new type of option, "OPT_FILENAME", to do this uniformly, but this patch is meant to go to 'maint' to fix it minimally. One thing to note is that value for "commit template file" that comes from the command line is taken as relative to $cwd just like other parameters, but when it comes from the configuration varilable 'commit.template', it is taken as relative to the working tree root as before. I think this difference actually is sensible (not that I particularly think commit.template itself is sensible). Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Fix "config_error_nonbool" used with value instead of keyChristian Couder2008-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | The function "config_error_nonbool", that is defined in "config.c", is used to report an error when a config key in the config file should have a corresponding value but it hasn't. So the parameter to this function should be the key and not the value, because the value is undefined. And it could crash if the value is used. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | editor.c: Libify launch_editor()Stephan Beyer2008-07-25
| | | | | | | | | | | | | | | | | | This patch removes exit()/die() calls and builtin-specific messages from launch_editor(), so that it can be used as a general libgit.a function to launch an editor. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Move launch_editor() from builtin-tag.c to editor.cStephan Beyer2008-07-25
| | | | | | | | | | | | | | | | | | launch_editor() is declared in strbuf.h but defined in builtin-tag.c. This patch moves launch_editor() into a new source file editor.c, but keeps the declaration in strbuf.h. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'sb/dashless'Junio C Hamano2008-07-16
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sb/dashless: Make usage strings dash-less t/: Use "test_must_fail git" instead of "! git" t/test-lib.sh: exit with small negagive int is ok with test_must_fail Conflicts: builtin-blame.c builtin-mailinfo.c builtin-mailsplit.c builtin-shortlog.c git-am.sh t/t4150-am.sh t/t4200-rerere.sh
| * | Make usage strings dash-lessStephan Beyer2008-07-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you misuse a git command, you are shown the usage string. But this is currently shown in the dashed form. So if you just copy what you see, it will not work, when the dashed form is no longer supported. This patch makes git commands show the dash-less version. For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh generates a dash-less usage string now. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Convert CR/LF to LF in tag signaturesJohannes Schindelin2008-07-11
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, gpg outputs CR/LF signatures. But since the tag messages are already stripped of the CR by stripspace(), it is arguably nicer to do the same for the tag signature. Actually, this patch does not look for CR/LF, but strips all CRs from the signature. It does so not only on Windows but on all platforms to keep the code simpler. [ spr: ported code to use strbuf ] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Fix "config_error_nonbool" used with value instead of keyChristian Couder2008-07-05
|/ | | | | | | | | | | | | | | | The function "config_error_nonbool", that is defined in "config.c", is used to report an error when a config key in the config file should have a corresponding value but it hasn't. So the parameter to this function should be the key and not the value, because the value is undefined. And it could crash if the value is used. This patches fixes two occurences where the value was passed instead of the key. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Provide git_config with a callback-data parameterJohannes Schindelin2008-05-14
| | | | | | | | | | | | git_config() only had a function parameter, but no callback data parameter. This assumes that all callback functions only modify global variables. With this patch, every callback gets a void * parameter, and it is hoped that this will help the libification effort. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-04-10
|\ | | | | | | | | | | | | * maint-1.5.4: core-tutorial.txt: Fix showing the current behaviour. git-archive: ignore prefix when checking file attribute Fix documentation syntax of optional arguments in short options.
| * Fix documentation syntax of optional arguments in short options.Carlos Rica2008-04-10
| | | | | | | | | | | | | | | | | | | | | | When an argument for an option is optional, like in -n from git-tag, puting a space between the option and the argument is interpreted as a missing argument for the option plus an isolated argument. Documentation now reflects the need to write the parameter following the option -n, as in "git tag -nARG", for instance. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint'Junio C Hamano2008-03-11
|\ \ | |/ | | | | | | | | | | | | * maint: git-svn: fix find-rev error message when missing arg t0021: tr portability fix for Solaris launch_editor(): allow spaces in the filename git rebase --abort: always restore the right commit
| * launch_editor(): allow spaces in the filenameJohannes Schindelin2008-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The construct sh -c "$0 \"$@\"" <editor> <file> does not pick up quotes in <editor>, so you cannot give path to the editor that has a shell IFS whitespace in it, and also give it initial set of parameters and flags. Replace $0 with <editor> to fix this issue. This fixes git config core.editor '"c:/Program Files/What/Ever.exe"' In other words, you can specify an editor with spaces in its path using a config containing something like this: [core] editor = \"c:/Program Files/Darn/Spaces.exe\" NOTE: we cannot just replace the $0 with \"$0\", because we still want this to work: [core] editor = emacs -nw Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | start_command(), .in/.out/.err = -1: Callers must close the file descriptorJohannes Sixt2008-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By setting .in, .out, or .err members of struct child_process to -1, the callers of start_command() can request that a pipe is allocated that talks to the child process and one end is returned by replacing -1 with the file descriptor. Previously, a flag was set (for .in and .out, but not .err) to signal finish_command() to close the pipe end that start_command() had handed out, so it was optional for callers to close the pipe, and many already do so. Now we make it mandatory to close the pipe. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | builtin-tag.c: remove cruftGerrit Pape2008-02-22
|/ | | | | | | | | | After changing builtin-tag.c to use strbuf in fd17f5b (Replace all read_fd use with strbuf_read, and get rid of it.), the last condition in do_sign() will always be false, as it's checked already right above. So let's remove the cruft. Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin-tag.c: guard config parser from value=NULLJunio C Hamano2008-02-11
| | | | | | user.signingkey configuration expects a string value. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix $EDITOR regression introduced by rewrite in C.Junio C Hamano2007-12-22
| | | | | | | | | | When git-tag and git-commit launches the editor, they used to honor EDITOR="editor -options args..." but recent rewrite in C insisted on $EDITOR to be the path to the editor executable. This restores the older behaviour. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-tag: fix -l switch handling regression.Pierre Habouzit2007-12-22
| | | | | | | | | | | | | | The command itself takes an optional <pattern> argument that limits the shown tags to the ones that match when in listing mode that is triggered with '-l' option. The <pattern> is not an optional option-argument to '-l'. With this fix, "git tag -l -n 4 v0.99" works as expected. It also removes a few bogus tests in t7004. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* "git tag -u keyname" brokenLinus Torvalds2007-12-11
| | | | | | | | | | | | | | | | | Commit 396865859918e9c7bf8ce74aae137c57da134610 broke signed tags using the "-u" flag when it made builtin-tag.c use parse_options() to parse its arguments (but it quite possibly was broken even before that, by the builtin rewrite). It used to be that passing the signing ID with the -u parameter also (obviously!) implied that you wanted to sign and annotate the tag, but that logic got dropped. It also totally ignored the actual key ID that was passed in. This reinstates it all. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Re-fix "builtin-commit: fix --signoff"Junio C Hamano2007-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An earlier fix to the said commit was incomplete; it mixed up the meaning of the flag parameter passed to the internal fmt_ident() function, so this corrects it. git_author_info() and git_committer_info() can be told to issue a warning when no usable user information is found, and optionally can be told to error out. Operations that actually use the information to record a new commit or a tag will still error out, but the caller to leave reflog record will just silently use bogus user information. Not warning on misconfigured user information while writing a reflog entry is somewhat debatable, but it is probably nicer to the users to silently let it pass, because the only information you are losing is who checked out the branch. * git_author_info() and git_committer_info() used to take 1 (positive int) to error out with a warning on misconfiguration; this is now signalled with a symbolic constant IDENT_ERROR_ON_NO_NAME. * These functions used to take -1 (negative int) to warn but continue; this is now signalled with a symbolic constant IDENT_WARN_ON_NO_NAME. * fmt_ident() function implements the above error reporting behaviour common to git_author_info() and git_committer_info(). A symbolic constant IDENT_NO_DATE can be or'ed in to the flag parameter to make it return only the "Name <email@address.xz>". * fmt_name() is a thin wrapper around fmt_ident() that always passes IDENT_ERROR_ON_NO_NAME and IDENT_NO_DATE. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix commit-msg hook to allow editingJunio C Hamano2007-12-09
| | | | | | | | | | | The old git-commit.sh script allowed the commit-msg hook to not only prevent a commit from proceding, but also to edit the commit message on the fly and allow it to proceed. So here we teach builtin-commit to do the same. This is based on Wincent's patch, but redone with a clarified logic. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'kh/commit'Junio C Hamano2007-12-04
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * kh/commit: (33 commits) git-commit --allow-empty git-commit: Allow to amend a merge commit that does not change the tree quote_path: fix collapsing of relative paths Make git status usage say git status instead of git commit Fix --signoff in builtin-commit differently. git-commit: clean up die messages Do not generate full commit log message if it is not going to be used Remove git-status from list of scripts as it is builtin Fix off-by-one error when truncating the diff out of the commit message. builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well. Add a few more tests for git-commit builtin-commit: Include the diff in the commit message when verbose. builtin-commit: fix partial-commit support Fix add_files_to_cache() to take pathspec, not user specified list of files Export three helper functions from ls-files builtin-commit: run commit-msg hook with correct message file builtin-commit: do not color status output shown in the message template file_exists(): dangling symlinks do exist Replace "runstatus" with "status" in the tests t7501-commit: Add test for git commit <file> with dirty index. ...
| * builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well.Pierre Habouzit2007-11-26
| | | | | | | | | | | | | | | | | | | | The editor program to let the user edit the log message used to get GIT_INDEX_FILE environment variable pointing at the right file, but this was lost when git-commit was rewritten in C. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Acked-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * launch_editor(): read the file, even when EDITOR=:Johannes Schindelin2007-11-22
| | | | | | | | | | | | | | | | | | Earlier we just returned in case EDITOR=: but the message stored in the file was not read back. Fix this, at the same time simplifying the code as suggested by Johannes Sixt. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Export launch_editor() and make it accept ':' as a no-op editor.Kristian Høgsberg2007-11-22
| | | | | | | | | | Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | "git-tag -s" should create a signed annotated tagJunio C Hamano2007-11-25
| | | | | | | | | | | | | | The earlier patch 396865859918e9c7bf8ce74aae137c57da134610 (Make builtin-tag.c use parse_options.) broke "git-tag -s". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | builtin-tag: accept and process multiple -m just like git-commitJunio C Hamano2007-11-22
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Make builtin-tag.c use parse_options.Carlos Rica2007-11-18
|/ | | | | | | | | | Also, this removes those tests ensuring that repeated -m options don't allocate memory more than once, because now this is done after parsing options, using the last one when more are given. The same for -F. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'mh/retag'Junio C Hamano2007-11-14
|\ | | | | | | | | | | * mh/retag: Add tests for git tag Reuse previous annotation when overwriting a tag
| * Reuse previous annotation when overwriting a tagMike Hommey2007-11-05
| | | | | | | | | | | | | | | | | | | | When forcing to overwrite an annotated tag, there are good chances one wants to keep the old annotation, or modify it, not start from scratch. This is obviously only triggered for annotated tagging (-a or -s). Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Small code readability improvement in show_reference() in builtin-tag.cMike Hommey2007-11-07
|/ | | | | Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* strbuf_read_file enhancement, and use it.Pierre Habouzit2007-09-29
| | | | | | | | * make strbuf_read_file take a size hint (works like strbuf_read) * use it in a couple of places. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Clean up stripspace a bit, use strbuf even more.Kristian Høgsberg2007-09-27
| | | | | Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add strbuf_read_file().Kristian Høgsberg2007-09-27
| | | | | Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Now that cache.h needs strbuf.h, remove useless includes.Pierre Habouzit2007-09-16
| | | | | | Signed-off-by: Pierre Habouzit <madcoder@debian.org> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Replace all read_fd use with strbuf_read, and get rid of it.Pierre Habouzit2007-09-10
| | | | | | | This brings builtin-stripspace, builtin-tag and mktag to use strbufs. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>