aboutsummaryrefslogtreecommitdiff
path: root/builtin-update-ref.c
Commit message (Collapse)AuthorAge
* Fix git update-ref --no-deref -d.Miklos Vajna2008-10-26
| | | | | | | Till now --no-deref was just ignored when deleting refs, fix this. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* 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>
* 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>
* Make old sha1 optional with git update-ref -dKarl Hasselström2008-06-02
| | | | | | | | | Giving the old sha1 is already optional when changing a ref, and it's quite handy when running update-ref manually. So make it optional for deleting a ref too. Signed-off-by: Karl Hasselström <kha@treskal.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Clean up builtin-update-ref's option parsingKarl Hasselström2008-06-02
| | | | | | | | | builtin-update-ref's option parsing was somewhat tricky to follow, especially if the -d option was given. This patch cleans it upp a bit, at the expense of making it a bit longer. Signed-off-by: Karl Hasselström <kha@treskal.com> 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>
* Make builtin-update-ref.c use parse_optionsPierre Habouzit2007-10-29
| | | | | Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Function for updating refs.Carlos Rica2007-09-05
| | | | | | | | | | | A function intended to be called from builtins updating refs by locking them before write, specially those that came from scripts using "git update-ref". [jc: with minor fixups] Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* symbolic-ref, update-ref: do not refuse reflog message with LFJunio C Hamano2007-07-29
| | | | | | | | | | | | | Earlier these tools refused to create a reflog entry when the message given by the calling Porcelain had a LF in it, partially to keep the file format integrity of reflog file, which is one-entry-per-line. These tools should not be dictating such a policy. Instead, let the codepath to write out the reflog entry worry about the format integrity and allow messages with LF in them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-update-ref: add --no-deref option for overwriting/detaching refSven Verdoolaege2007-05-10
| | | | | | | | git-checkout is also adapted to make use of this new option instead of the handcrafted command sequence. Signed-off-by: Sven Verdoolaege <skimo@kotnet.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* lock_any_ref_for_update(): do not accept malformatted refs.Junio C Hamano2007-01-29
| | | | | | | | | | | | | | We used to use lock_any_ref_for_update() because the command needs to also update HEAD (which is not under refs/, so lock_ref_sha1() cannot be used). The function however did not check for refs with illegal characters in them. Use check_ref_format() to catch malformed refs. For this check, we specifically do not want to say having less than two levels in the name is illegal to allow HEAD (and perhaps other special refs in the future). Signed-off-by: Junio C Hamano <junkio@cox.net>
* Don't force everybody to call setup_ident().Junio C Hamano2007-01-28
| | | | | | | | | | | | Back when only handful commands that created commit and tag were the only users of committer identity information, it made sense to explicitly call setup_ident() to pre-fill the default value from the gecos information. But it is much simpler for programs to make the call automatic when get_ident() is called these days, since many more programs want to use the information when updating the reflog. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-merge: leave sensible reflog message when used as the first level UI.Junio C Hamano2007-01-26
| | | | | | | | | | | It used to throw potentially multi-line log message at reflog. Just record the heads that were given to be merged at the command line and the action. Revert the removal of the check in "git-update-ref -m" I made earlier which was only a work-around for this. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make sure we do not write bogus reflog entries.Junio C Hamano2007-01-26
| | | | | | | | | The file format dictates that entries are LF terminated so the message cannot have one in it. Chomp the message to make sure it only has a single line if necessary, while removing the leading whitespace. Signed-off-by: Junio C Hamano <junkio@cox.net>
* update-ref: -d flag and ref creation safety.Junio C Hamano2006-09-27
| | | | | | | | | | | This adds -d flag to update-ref to allow safe deletion of ref. Before deleting it, the command checks if the given <oldvalue> still matches the value the caller thought the ref contained. Similarly, it also accepts 0{40} or an empty string as <oldvalue> to allow safe creation of a new ref. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Clean-up lock-ref implementationJunio C Hamano2006-09-27
| | | | | | | This drops "mustexist" parameter lock_ref_sha1() and lock_any_ref_forupdate() functions take. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Convert memset(hash,0,20) to hashclr(hash).Junio C Hamano2006-08-23
| | | | | | In the same spirit as hashcmp() and hashcpy(). Signed-off-by: Junio C Hamano <junkio@cox.net>
* Call setup_git_directory() much earlierLinus Torvalds2006-07-29
| | | | | | | | | This changes the calling convention of built-in commands and passes the "prefix" (i.e. pathname of $PWD relative to the project root level) down to them. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Allow user.name and user.email to drive reflog entry.Shawn Pearce2006-07-10
| | | | | | | | | | | | | | Apparently calling setup_ident() after git_config causes the user.name and user.email values read from the config file to be replaced with the data obtained from the host. This means that users who have setup their email address in user.email will instead be writing reflog entries with their hostname. Moving setup_ident() to before git_config in update-ref resolves this ordering problem. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-update-ref a builtinLukas Sandström2006-06-18
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>