aboutsummaryrefslogtreecommitdiff
path: root/refs.c
Commit message (Collapse)AuthorAge
* Merge branch 'hv/submodule-find-ff-merge'Junio C Hamano2010-08-21
|\ | | | | | | | | | | | | | | | | | | * hv/submodule-find-ff-merge: Implement automatic fast-forward merge for submodules setup_revisions(): Allow walking history in a submodule Teach ref iteration module about submodules Conflicts: submodule.c
| * setup_revisions(): Allow walking history in a submoduleHeiko Voigt2010-07-07
| | | | | | | | | | | | | | | | | | By passing the path to a submodule in opt->submodule, the function can be used to walk history in the named submodule repository, instead of the toplevel repository. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Teach ref iteration module about submodulesHeiko Voigt2010-07-07
| | | | | | | | | | | | | | | | We will use this in a later patch to extend setup_revisions() to load revisions directly from a submodule. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint'Junio C Hamano2010-07-07
|\ \ | |/ |/| | | | | | | | | | | | | | | | | * maint: backmerge a few more fixes to 1.7.1.X series rev-parse: fix --parse-opt --keep-dashdash --stop-at-non-option fix git branch -m in presence of cross devices Conflicts: RelNotes builtin/rev-parse.c
| * fix git branch -m in presence of cross devicesPierre Habouzit2010-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you have for example a bare repository stored on NFS, and that you create new workdirs locally (using contrib's git-new-workdir), logs/refs is a symlink to a different device. Hence when the reflogs are renamed, all must happen below logs/refs or one gets cross device rename errors like: git branch -m foo error: unable to move logfile logs/refs/heads/master to tmp-renamed-log: Invalid cross-device link fatal: Branch rename failed The fix is hence to use logs/refs/.tmp-renamed-log as a temporary log name, instead of just tmp-renamed-log. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'gv/portable'Junio C Hamano2010-06-21
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gv/portable: test-lib: use DIFF definition from GIT-BUILD-OPTIONS build: propagate $DIFF to scripts Makefile: Tru64 portability fix Makefile: HP-UX 10.20 portability fixes Makefile: HPUX11 portability fixes Makefile: SunOS 5.6 portability fix inline declaration does not work on AIX Allow disabling "inline" Some platforms lack socklen_t type Make NO_{INET_NTOP,INET_PTON} configured independently Makefile: some platforms do not have hstrerror anywhere git-compat-util.h: some platforms with mmap() lack MAP_FAILED definition test_cmp: do not use "diff -u" on platforms that lack one fixup: do not unconditionally disable "diff -u" tests: use "test_cmp", not "diff", when verifying the result Do not use "diff" found on PATH while building and installing enums: omit trailing comma for portability Makefile: -lpthread may still be necessary when libc has only pthread stubs Rewrite dynamic structure initializations to runtime assignment Makefile: pass CPPFLAGS through to fllow customization Conflicts: Makefile wt-status.h
| * | Rewrite dynamic structure initializations to runtime assignmentGary V. Vaughan2010-05-31
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, there are still plenty of production systems with vendor compilers that choke unless all compound declarations can be determined statically at compile time, for example hpux10.20 (I can provide a comprehensive list of our supported platforms that exhibit this problem if necessary). This patch simply breaks apart any compound declarations with dynamic initialisation expressions, and moves the initialisation until after the last declaration in the same block, in all the places necessary to have the offending compilers accept the code. Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | log_ref_setup: don't return stack-allocated arrayThomas Rast2010-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 859c301 (refs: split log_ref_write logic into log_ref_setup, 2010-05-21) refactors the stack allocation of the log_file array into the new log_ref_setup() function, but passes it back to the caller. Since the original intent seems to have been to split the work between log_ref_setup and log_ref_write, make it the caller's responsibility to allocate the buffer. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | refs: split log_ref_write logic into log_ref_setupErick Mattos2010-06-02
|/ | | | | | | | | | | Separation of the logic for testing and preparing the reflogs from function log_ref_write to a new non static new function: log_ref_setup. This allows to be performed from outside the first all reasonable checks and procedures for writing reflogs. Signed-off-by: Erick Mattos <erick.mattos@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* refs.c: Write reflogs for notes just like for branch headsMichael J Gruber2010-03-29
| | | | | | | | | | | | | | The notes code intends to write reflog entries, but currently they are not written because log_ref_write() checks for the refname path explicitly. Add refs/notes to the list of allowed paths so that notes references are treated just like branch heads, i.e. according to core.logAllRefUpdates and core.bare. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'tr/notes-display'Junio C Hamano2010-03-24
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tr/notes-display: git-notes(1): add a section about the meaning of history notes: track whether notes_trees were changed at all notes: add shorthand --ref to override GIT_NOTES_REF commit --amend: copy notes to the new commit rebase: support automatic notes copying notes: implement helpers needed for note copying during rewrite notes: implement 'git notes copy --stdin' rebase -i: invoke post-rewrite hook rebase: invoke post-rewrite hook commit --amend: invoke post-rewrite hook Documentation: document post-rewrite hook Support showing notes from more than one notes tree test-lib: unset GIT_NOTES_REF to stop it from influencing tests Conflicts: git-am.sh refs.c
| * Support showing notes from more than one notes treeThomas Rast2010-03-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this patch, you can set notes.displayRef to a glob that points at your favourite notes refs, e.g., [notes] displayRef = refs/notes/* Then git-log and friends will show notes from all trees. Thanks to Junio C Hamano for lots of feedback, which greatly influenced the design of the entire series and this commit in particular. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jc/maint-refs-dangling'Junio C Hamano2010-03-24
|\ \ | | | | | | | | | | | | * jc/maint-refs-dangling: refs: ref entry with NULL sha1 is can be a dangling symref
| * | refs: ref entry with NULL sha1 is can be a dangling symrefJunio C Hamano2010-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Brandon Casey noticed that t5505 had accidentally broken its && chain, hiding inconsistency between the code that writes the warning to the standard output and the test that expects to see the warning on the standard error, which was introduced by f8948e2 (remote prune: warn dangling symrefs, 2009-02-08). It turns out that the issue is deeper than that. After f8948e2, a symref that is dangling is marked with a NULL sha1, and the idea of using NULL sha1 to mean a deleted ref was scrapped, but somehow a follow-up eafb452 (do_one_ref(): null_sha1 check is not about broken ref, 2009-07-22) incorrectly reorganized do_one_ref(), still thinking NULL sha1 is never used in the code. Fix this by: - adopt Brandon's fix to t5505 test; - introduce REF_BROKEN flag to mark a ref that fails to resolve (dangling symref); - move the check for broken ref back inside the "if we are skipping dangling refs" code block. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | for_each_recent_reflog_ent(): use strbuf, fix offset handlingRené Scharfe2010-03-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Vladimir reported, "git log -g refs/stash" surprisingly showed the reflog of HEAD if the message in the reflog file was too long. To fix this, convert for_each_recent_reflog_ent() to use strbuf_getwholeline() instead of fgets(), for safety and to avoid any size limits for reflog entries. Also reverse the logic of the part of the function that only looks at file tails. It used to close the file if fgets() succeeded. The following fgets() call in the while loop was likely to fail in this case, too, so passing an offset to for_each_recent_reflog_ent() never worked. Change it to error out if strbuf_getwholeline() fails instead. Reported-by: Vladimir Panteleev <vladimir@thecybershadow.net> Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Typofixes outside documentation areaJunio C Hamano2010-02-03
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | begining -> beginning canonicalizations -> canonicalization comand -> command dewrapping -> unwrapping dirtyness -> dirtiness DISCLAMER -> DISCLAIMER explicitely -> explicitly feeded -> fed impiled -> implied madatory -> mandatory mimick -> mimic preceeding -> preceding reqeuest -> request substition -> substitution Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | rev-parse --branches/--tags/--remotes=patternIlari Liusvaara2010-01-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since local branch, tags and remote tracking branch namespaces are most often used, add shortcut notations for globbing those in manner similar to --glob option. With this, one can express the "what I have but origin doesn't?" as: 'git log --branches --not --remotes=origin' Original-idea-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | rev-parse --globIlari Liusvaara2010-01-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add --glob=<glob-pattern> option to rev-parse and everything that accepts its options. This option matches all refs that match given shell glob pattern (complete with some DWIM logic). Example: 'git log --branches --not --glob=remotes/origin' To show what you have that origin doesn't. Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | teach warn_dangling_symref to take a FILE argumentJay Soffian2009-11-10
| | | | | | | | | | | | | | | | Different callers of warn_dangling_symref() may want to control whether its output goes to stdout or stderr so let it take a FILE argument. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git branch -D: give a better error message when lockfile creation failsMiklos Vajna2009-09-29
| | | | | | | | | | | | | | | | | | | | Previously the old error message just told the user that it was not possible to delete the ref from the packed-refs file. Give instructions on how to resolve the problem. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge branch 'cc/replace'Junio C Hamano2009-08-21
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cc/replace: t6050: check pushing something based on a replaced commit Documentation: add documentation for "git replace" Add git-replace to .gitignore builtin-replace: use "usage_msg_opt" to give better error messages parse-options: add new function "usage_msg_opt" builtin-replace: teach "git replace" to actually replace Add new "git replace" command environment: add global variable to disable replacement mktag: call "check_sha1_signature" with the replacement sha1 replace_object: add a test case object: call "check_sha1_signature" with the replacement sha1 sha1_file: add a "read_sha1_file_repl" function replace_object: add mechanism to replace objects found in "refs/replace/" refs: add a "for_each_replace_ref" function
| * | refs: add a "for_each_replace_ref" functionChristian Couder2009-05-31
| | | | | | | | | | | | | | | | | | | | | | | | This is some preparation work for the following patches that are using the "refs/replace/" ref namespace. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | clean: require double -f options to nuke nested git repository and work treeJunio C Hamano2009-07-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | When you have an embedded git work tree in your work tree (be it an orphaned submodule, or an independent checkout of an unrelated project), "git clean -d -f" blindly descended into it and removed everything. This is rarely what the user wants. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint'Junio C Hamano2009-07-24
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * maint: SunOS grep does not understand -C<n> nor -e Fix export_marks() error handling. git branch: clean up detached branch handling git branch: avoid unnecessary object lookups git branch: fix performance problem do_one_ref(): null_sha1 check is not about broken ref Conflicts: Makefile
| * | do_one_ref(): null_sha1 check is not about broken refJunio C Hamano2009-07-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f8948e2 (remote prune: warn dangling symrefs, 2009-02-08) introduced a more dangerous variant of for_each_ref() family that skips the check for dangling refs, but it also made another unrelated check optional by mistake. The check to see if a ref points at 0{40} is not about brokenness, but is about a possible future plan to represent a deleted ref by writing 40 "0" in a loose ref when there is a stale version of the same ref already in .git/packed-refs, so that we can implement deletion of a ref without having to rewrite the packed refs file excluding the ref being deleted. This check has to live outside of the conditional. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint'Junio C Hamano2009-07-18
|\ \ \ | |/ / | | | | | | | | | | | | | | | * maint: checkout -f: deal with a D/F conflict entry correctly sha1_name.c: avoid unnecessary strbuf_release refs.c: release file descriptor on error return
| * | refs.c: release file descriptor on error returnBrandon Casey2009-07-16
| | | | | | | | | | | | | | | Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Convert existing die(..., strerror(errno)) to die_errno()Thomas Rast2009-06-27
| |/ |/| | | | | | | | | | | | | | | | | | | Change calls to die(..., strerror(errno)) to use the new die_errno(). In the process, also make slight style adjustments: at least state _something_ about the function that failed (instead of just printing the pathname), and put paths in single quotes. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint'Junio C Hamano2009-05-25
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * maint: Prepare for 1.6.3.2 fix cat-file usage message and documentation fetch: report ref storage DF errors more accurately lock_ref: inform callers of unavailable ref merge-options.txt: Clarify merge --squash Conflicts: RelNotes
| * Merge branch 'ar/unlink-err' into maintJunio C Hamano2009-05-25
| |\ | | | | | | | | | | | | | | | | | | * ar/unlink-err: print unlink(2) errno in copy_or_link_directory replace direct calls to unlink(2) with unlink_or_warn Introduce an unlink(2) wrapper which gives warning if unlink failed
| * | lock_ref: inform callers of unavailable refJeff King2009-05-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the ways that locking might fail is that there is a DF conflict between two refs (e.g., you want to lock "foo/bar" but "foo" already exists). In this case, we return an error, but there is no way for the caller to know the specific problem. This patch sets errno to ENOTDIR, which is the most sensible code. It's what we would see if the refs were stored purely in the filesystem (but these days we must check the namespace manually due to packed refs). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'fc/decorate-tag'Junio C Hamano2009-05-23
|\ \ \ | | | | | | | | | | | | | | | | | | | | * fc/decorate-tag: Prettify log decorations even more Change prettify_ref to prettify_refname
| * | | Change prettify_ref to prettify_refnameFelipe Contreras2009-05-13
| |/ / | | | | | | | | | | | | | | | | | | | | | In preparation to be used when the ref object is not available Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'rr/forbid-bs-in-ref'Junio C Hamano2009-05-23
|\ \ \ | |_|/ |/| | | | | | | | * rr/forbid-bs-in-ref: Disallow '\' in ref names
| * | Disallow '\' in ref namesRobin Rosenberg2009-05-09
| |/ | | | | | | | | | | | | | | This is asking for trouble since '\' is a directory separator in Windows and thus may produce unpredictable results. Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | replace direct calls to unlink(2) with unlink_or_warnAlex Riesen2009-04-29
|/ | | | | | | | | | | | | | | | | This helps to notice when something's going wrong, especially on systems which lock open files. I used the following criteria when selecting the code for replacement: - it was already printing a warning for the unlink failures - it is in a function which already printing something or is called from such a function - it is in a static function, returning void and the function is only called from a builtin main function (cmd_) - it is in a function which handles emergency exit (signal handlers) - it is in a function which is obvously cleaning up the lockfiles Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* shorten_unambiguous_ref(): add strict modeBert Wesarg2009-04-13
| | | | | | | | | | Add the strict mode of abbreviation to shorten_unambiguous_ref(), i.e. the resulting ref won't trigger the ambiguous ref warning. All users of shorten_unambiguous_ref() still use the loose mode. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jk/show-upstream'Junio C Hamano2009-04-12
|\ | | | | | | | | | | | | | | | | * jk/show-upstream: branch: show upstream branch when double verbose make get_short_ref a public function for-each-ref: add "upstream" format field for-each-ref: refactor refname handling for-each-ref: refactor get_short_ref function
| * make get_short_ref a public functionJeff King2009-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Often we want to shorten a full ref name to something "prettier" to show a user. For example, "refs/heads/master" is often shown simply as "master", or "refs/remotes/origin/master" is shown as "origin/master". Many places in the code use a very simple formula: skip common prefixes like refs/heads, refs/remotes, etc. This is codified in the prettify_ref function. for-each-ref has a more correct (but more expensive) approach: consider the ref lookup rules, and try shortening as much as possible while remaining unambiguous. This patch makes the latter strategy globally available as shorten_unambiguous_ref. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'cc/bisect-filter'Junio C Hamano2009-04-12
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cc/bisect-filter: (21 commits) rev-list: add "int bisect_show_flags" in "struct rev_list_info" rev-list: remove last static vars used in "show_commit" list-objects: add "void *data" parameter to show functions bisect--helper: string output variables together with "&&" rev-list: pass "int flags" as last argument of "show_bisect_vars" t6030: test bisecting with paths bisect: use "bisect--helper" and remove "filter_skipped" function bisect: implement "read_bisect_paths" to read paths in "$GIT_DIR/BISECT_NAMES" bisect--helper: implement "git bisect--helper" bisect: use the new generic "sha1_pos" function to lookup sha1 rev-list: call new "filter_skip" function patch-ids: use the new generic "sha1_pos" function to lookup sha1 sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1 rev-list: pass "revs" to "show_bisect_vars" rev-list: make "show_bisect_vars" non static rev-list: move code to show bisect vars into its own function rev-list: move bisect related code into its own file rev-list: make "bisect_list" variable local to "cmd_rev_list" refs: add "for_each_ref_in" function to refactor "for_each_*_ref" functions quote: add "sq_dequote_to_argv" to put unwrapped args in an argv array ...
| * Merge branch 'cc/sha1-bsearch' into HEADJunio C Hamano2009-04-04
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cc/sha1-bsearch: (95 commits) patch-ids: use the new generic "sha1_pos" function to lookup sha1 sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1 Update draft release notes to 1.6.3 GIT 1.6.2.2 send-email: ensure quoted addresses are rfc2047 encoded send-email: correct two tests which were going interactive Documentation: git-svn: fix trunk/fetch svn-remote key typo Mailmap: Allow empty email addresses to be mapped Cleanup warning about known issues in cvsimport documentation Documentation: Remove an odd "instead" send-email: ask_default should apply to all emails, not just the first send-email: don't attempt to prompt if tty is closed fix portability problem with IS_RUN_COMMAND_ERR Documentation: use "spurious .sp" XSLT if DOCBOOK_SUPPRESS_SP is set mailmap: resurrect lower-casing of email addresses builtin-clone.c: no need to strdup for setenv builtin-clone.c: make junk_pid static git-svn: add a double quiet option to hide git commits Update draft release notes to 1.6.2.2 Documentation: push.default applies to all remotes ...
| * | refs: add "for_each_ref_in" function to refactor "for_each_*_ref" functionsChristian Couder2009-03-30
| | | | | | | | | | | | | | | | | | | | | | | | The "for_each_{tag,branch,remote,replace,}_ref" functions are redefined in terms of "for_each_ref_in" so that we can lose the hardcoded length of prefix strings from the code. Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
* | | Merge branch 'jc/name-branch'Junio C Hamano2009-04-06
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jc/name-branch: Don't permit ref/branch names to end with ".lock" check_ref_format(): tighten refname rules strbuf_check_branch_ref(): a helper to check a refname for a branch Fix branch -m @{-1} newname check-ref-format --branch: give Porcelain a way to grok branch shorthand strbuf_branchname(): a wrapper for branch name shorthands Rename interpret/substitute nth_last_branch functions Conflicts: Documentation/git-check-ref-format.txt
| * | Don't permit ref/branch names to end with ".lock"Shawn O. Pearce2009-03-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already skip over loose refs under $GIT_DIR/refs if the name ends with ".lock", so creating a branch named "foo.lock" will not appear in the output of "git branch", "git for-each-ref", nor will its commit be considered reachable by "git rev-list --all". In the latter case this is especially evil, as it may cause repository corruption when objects reachable only through such a ref are deleted by "git prune". It should be reasonably safe to deny use of ".lock" as a ref suffix. In prior versions of Git such branches would be "phantom branches"; you can create it, but you can't see it in "git branch" output. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | check_ref_format(): tighten refname rulesJunio C Hamano2009-03-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the rules for refnames to forbid: (1) a refname that contains "@{" in it. Some people and foreign SCM converter may have named their branches as frotz@24 and we still want to keep supporting it. However, "git branch frotz@{24}" is a disaster. It cannot even checked out because "git checkout frotz@{24}" will interpret it as "detach the HEAD at twenty-fourth reflog entry of the frotz branch". (2) a refname that ends with a dot. We already reject a path component that begins with a dot, primarily to avoid ambiguous range interpretation. If we allowed ".B" as a valid ref, it is unclear if "A...B" means "in dot-B but not in A" or "either in A or B but not in both". But for this to be complete, we need also to forbid "A." to avoid "in B but not in A-dot". This was not a problem in the original range notation, but we should have added this restriction when three-dot notation was introduced. Unlike "no dot at the beginning of any path component" rule, this rule does not have to be "no dot at the end of any path component", because you cannot abbreviate the tail end away, similar to you can say "dot-B" to mean "refs/heads/dot-B". For these reasons, it is not likely people created branches with these names on purpose, but we have allowed such names to be used for quite some time, and it is possible that people created such branches by mistake or by accident. To help people with branches with such unfortunate names to recover, we still allow "branch -d 'bad.'" to delete such branches, and also allow "branch -m bad. good" to rename them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'db/push-cleanup'Junio C Hamano2009-03-26
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | * db/push-cleanup: Move push matching and reporting logic into transport.c Use a common function to get the pretty name of refs Conflicts: transport.c
| * | Use a common function to get the pretty name of refsDaniel Barkalow2009-03-09
| | | | | | | | | | | | | | | | | | | | | | | | The result should be consistent between fetch and push, so we ought to use the same code in both cases, even though it's short. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | refs: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna2009-03-23
| |/ |/| | | | | | | Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Adjust js/remote-improvements and db/refspec-wildcard-in-the-middleJunio C Hamano2009-03-08
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | The latter topic changes the definition of how refspec's src and dst side is stored in-core; it used to be that the asterisk for pattern was omitted, but now it is included. The former topic handcrafts an old style refspec to feed the refspec matching machinery that lacks the asterisk and triggers an error. This resolves the semantic clash between the two topics early before they need to be merged to integration branches. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * refactor find_ref_by_name() to accept const listJeff King2009-02-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since it doesn't actually touch its argument, this makes sense. However, we still want to return a non-const version (which requires a cast) so that this: struct ref *a, *b; a = find_ref_by_name(b); works. Unfortunately, you can also silently strip the const from a variable: struct ref *a; const struct ref *b; a = find_ref_by_name(b); This is a classic C const problem because there is no way to say "return the type with the same constness that was passed to us"; we provide the same semantics as standard library functions like strchr. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>