1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-10 08:46:38 +02:00
Commit Graph

18840 Commits

Author SHA1 Message Date
Christian Couder bebdd271ff builtin-replace: teach "git replace" to actually replace
Teach the syntax: "git replace <object> <replacement>", so that
"git replace" can now create replace refs. These replace refs
will be used by read_sha1_file to substitute <object> with
<replacement> for most of the commands.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:03:00 -07:00
Christian Couder 54b0c1e041 Add new "git replace" command
This command can only be used now to list replace refs in
"refs/replace/" and to delete them.

The option to list replace refs is "-l".
The option to delete replace refs is "-d".

The behavior should be consistent with how "git tag" and "git branch"
are working.

The code has been copied from "builtin-tag.c" by Kristian Høgsberg
<krh@redhat.com> and Carlos Rica <jasampler@gmail.com> that was itself
based on git-tag.sh and mktag.c by Linus Torvalds.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:02:59 -07:00
Christian Couder dae556bdb1 environment: add global variable to disable replacement
This new "read_replace_refs" global variable is set to 1 by
default, so that replace refs are used by default. But
reachability traversal and packing commands ("cmd_fsck",
"cmd_prune", "cmd_pack_objects", "upload_pack",
"cmd_unpack_objects") set it to 0, as they must work with the
original DAG.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:02:59 -07:00
Christian Couder cc400f5011 mktag: call "check_sha1_signature" with the replacement sha1
Otherwise we get a "sha1 mismatch" error for replaced objects.

Note that I am not sure at all that this is a good change.
It may be that we should just refuse to tag a replaced object. But
in this case we should probably give a meaningfull error message
instead of "sha1 mismatch".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:02:59 -07:00
Christian Couder a3e8267225 replace_object: add a test case
In this patch the setup code is very big, but this will be used in
test cases that will be added later.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:02:59 -07:00
Christian Couder 0e87c36763 object: call "check_sha1_signature" with the replacement sha1
Otherwise we get a "sha1 mismatch" error for replaced objects.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:02:59 -07:00
Christian Couder f5552aee39 sha1_file: add a "read_sha1_file_repl" function
This new function will replace "read_sha1_file". This latter function
becoming just a stub to call the former will a NULL "replacement"
argument.

This new function is needed because sometimes we need to use the
replacement sha1.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:02:59 -07:00
Christian Couder 6809557029 replace_object: add mechanism to replace objects found in "refs/replace/"
The code implementing this mechanism has been copied more-or-less
from the commit graft code.

This mechanism is used in "read_sha1_file". sha1 passed to this
function that match a ref name in "refs/replace/" are replaced by
the sha1 that has been read in the ref.

We "die" if the replacement recursion depth is too high or if we
can't read the replacement object.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 17:02:59 -07:00
Christian Couder 292687003a refs: add a "for_each_replace_ref" function
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>
2009-05-31 17:02:59 -07:00
Junio C Hamano f9275c68af Merge branch 'sb/opt-filename'
* sb/opt-filename:
  parse-opts: add OPT_FILENAME and transition builtins
  parse-opts: prepare for OPT_FILENAME

Conflicts:
	builtin-log.c
2009-05-31 16:57:42 -07:00
Junio C Hamano 714cdcd03e Merge branch 'jc/solaris-0811'
* jc/solaris-0811:
  OpenSolaris 200811 (SunOS 5.11) does not want OLD_ICONV
  Teach Solaris that _XOPEN_SOURCE=600 really menas XPG6
2009-05-31 16:18:02 -07:00
Junio C Hamano c6e73936b9 Merge branch 'sb/show-branch-parse-options'
* sb/show-branch-parse-options:
  show-branch: migrate to parse-options API
  parse-options: add PARSE_OPT_LITERAL_ARGHELP for complicated argh's

Conflicts:
	parse-options.h
2009-05-31 16:17:58 -07:00
Junio C Hamano 919cc4d068 Merge branch 'mm/apply-double-slash'
* mm/apply-double-slash:
  apply: handle filenames with double slashes better
2009-05-31 16:17:46 -07:00
Junio C Hamano 1af4731b54 Merge branch 'sb/format-patch-parseopt'
* sb/format-patch-parseopt:
  format-patch: migrate to parse-options API

Conflicts:
	builtin-log.c
2009-05-31 16:17:31 -07:00
Junio C Hamano 128b0c08ca Merge branch 'jc/mktree'
* jc/mktree:
  mktree: validate entry type in input
  mktree --batch: build more than one tree object
  mktree --missing: updated usage message and man page
  mktree --missing: allow missing objects
  t1010: add mktree test
  mktree: do not barf on a submodule commit
  builtin-mktree.c: use a helper function to handle one line of input
  mktree: use parse-options
  build-in git-mktree
2009-05-31 16:17:11 -07:00
Junio C Hamano 22cdab5b3f Merge branch 'ew/svn-test-and-old-i18n'
* ew/svn-test-and-old-i18n:
  t8005: fix typo, it's ISO-8859-5, not KOI8-R
  t8005: convert CP1251 character set to ISO8859-5
  t8005: use more portable character encoding names
  t5100: use ancient encoding syntax for backwards compatibility
  t9301: use ISO8859-1 rather than ISO-8859-1
  t3901: Use ISO8859-1 instead of ISO-8859-1 for backward compatibility
  t3901: avoid negation on right hand side of '|'
  builtin-mailinfo.c: use "ISO8859-1" instead of "latin1" as fallback encoding
  builtin-mailinfo.c: compare character encodings case insensitively
  Use 'UTF-8' rather than 'utf-8' everywhere for backward compatibility
  t3900: use ancient iconv names for backward compatibility
2009-05-31 16:17:07 -07:00
Junio C Hamano 06676213d2 Merge branch 'mw/send-email'
* mw/send-email:
  send-email: Remove superfluous `my $editor = ...'
  send-email: 'References:' should only reference what is sent
  send-email: Handle "GIT:" rather than "GIT: " during --compose
  Docs: send-email: --smtp-server-port can take symbolic ports
  Docs: send-email: Refer to CONFIGURATION section for sendemail.multiedit
  Docs: send-email: Put options back into alphabetical order
2009-05-31 16:16:52 -07:00
Junio C Hamano 1136e2c642 Merge branch 'cc/bisect' (early part)
* 'cc/bisect' (early part):
  bisect: check ancestors without forking a "git rev-list" process
  commit: add function to unparse a commit and its parents
  bisect: rework some rev related functions to make them more reusable
2009-05-31 16:16:48 -07:00
Jeff King 6e4f981ffb git-add: no need for -f when resolving a conflict in already tracked path
When a path F that matches ignore pattern has a conflict, "git add F"
insisted the -f option be given, which did not make sense.  It would have
required -f when the path was originally added, but when resolving a
conflict, it already is tracked.

So this should work (and does):

  $ echo file >.gitignore
  $ echo content >file
  $ git add -f file ;# need -f because we are adding new path
  $ echo more content >>file
  $ git add file ;# don't need -f; it is not actually an "other" file

This is handled under the hood by the COLLECT_IGNORED option to
read_directory. When that code finds an ignored file, it checks the
index to make sure it is not actually a tracked file. However, the test
it uses does not take into account unmerged entries, and considers them
to still be ignored. "git ls-files" uses a more elaborate test and gets
the right answer and the same test should be used here.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 15:59:16 -07:00
Stephen Boyd 13bd213408 config.txt: document add.ignore-errors
Use the description of "--ignore-errors" from git-add.txt as
inspiration.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 15:40:09 -07:00
SZEDER Gábor ee6b71141f bash: remove always true if statement from __git_ps1()
The recent commits 8763dbb1 (completion: fix PS1 display during a
merge on detached HEAD, 2009-05-16), ff790b6a (completion: simplify
"current branch" in __git_ps1(), 2009-05-10), and d7107ca6
(completion: fix PS1 display during an AM on detached HEAD,
2009-05-26) ensure that the branch name in __git_ps1() is always set
to something sensible.  Therefore, the condition for checking the
non-empty branch name is always fulfilled, and can be removed.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 15:39:32 -07:00
Björn Steinbrink c4d5359230 git-apply(1): Clarify that one can select where to apply the patch
The patch can be applied to the work tree, the index or both, but the
short description made it look like it's always applied to both.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 15:39:04 -07:00
Clemens Buchacher 0bf8c1f9be http-push: reuse existing is_null_ref
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-31 15:38:32 -07:00
Eric Wong 188643140b t9139 uses ancient, backwards-compatible iconv names
This resolves a semantic conflicts early to work with 5ae93df (t3900: use
ancient iconv names for backward compatibility, 2009-05-18).

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-30 22:30:55 -07:00
Junio C Hamano 0ddbbb6661 Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  git-svn: refuse to dcommit non-UTF-8 messages
2009-05-30 22:25:41 -07:00
Thomas Rast d183663785 Documentation: teach stash/pop workflow instead of stash/apply
Recent discussion on the list showed some comments in favour of a
stash/pop workflow:

  http://marc.info/?l=git&m=124234911423358&w=2
  http://marc.info/?l=git&m=124235348327711&w=2

Change the stash documentation and examples to document pop in its own
right (and apply in terms of pop), and use stash/pop in the examples.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-30 22:21:29 -07:00
Junio C Hamano 9affecbc89 Merge branch 'sb/maint-1.6.2-opt-filename-fix'
* sb/maint-1.6.2-opt-filename-fix:
  apply, fmt-merge-msg: use relative filenames
  commit: -F overrides -t
2009-05-29 15:01:16 -07:00
Junio C Hamano 659f096896 Merge branch 'jc/maint-add-p-coalesce-fix'
* jc/maint-add-p-coalesce-fix:
  t3701: ensure correctly set up repository after skipped tests
  Revert "git-add--interactive: remove hunk coalescing"
  Splitting a hunk that adds a line at the top fails in "add -p"
2009-05-29 15:00:15 -07:00
Junio C Hamano 8e105e3928 Merge branch 'rs/maint-grep-word-regexp-fix'
* rs/maint-grep-word-regexp-fix:
  grep: fix word-regexp at the beginning of lines
2009-05-29 14:59:50 -07:00
Stephen Boyd 3be7e06713 t9120: don't expect failure with SVN_HTTPD_PORT unset
The test still passes when SVN_HTTPD_PORT is not set. Futhermore, t9115
and t9118 don't check if SVN_HTTPD_PORT is set even though they both use
start_httpd() from lib-git-svn.sh. Admittedly, the test is not very
meaningful without SVN_HTTPD_PORT, as commit f5530b (support for funky
branch and project names over HTTP(S) 2007-11-11) states that the URI
escaping is only done over HTTP(S).

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-29 00:53:43 -07:00
Junio C Hamano a9d29038a7 Merge branch 'maint'
* maint:
  fix segfault showing an empty remote
2009-05-28 22:50:23 -07:00
Eric Wong b510df8af2 git-svn: refuse to dcommit non-UTF-8 messages
...without i18n.commitencoding set in the config.

SVN tries to store all commit messages in UTF-8, however it is
up to the job of the clients to enforce this rule.  SVN servers
themselves do not always enforce this; allowing clients to
commit malformed UTF-8 messages and break repositories.

So git-svn will enforce this and tell the user to set
i18n.commitencoding when a git commit is is not in UTF-8.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2009-05-28 00:57:07 -07:00
Clemens Buchacher 6a01554e63 fix segfault showing an empty remote
In case of an empty list, the search for its tail caused a
NULL-pointer dereference.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Reported-by: Erik Faye-Lund <kusmabite@googlemail.com>
Acked-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-27 23:16:16 -07:00
Brandon Casey ed43bc8c4c t8005: fix typo, it's ISO-8859-5, not KOI8-R
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-27 20:24:55 -07:00
Stephen Boyd 3902985a58 t5500: Modernize test style
Code outside of the test harness was emitting "Initializing..." from
git-init. Fixup this test to be more modern:

    - test_expect_object_count() and count_objects() are unused

    - use grep directly instead of test "..." = $(grep ...)

    - end the test_expect_success line with a single-quote and put the
      test on a new line

    - put as much code inside the test harness as possible

    - no_strict_count_check is unused and duplicates the test
      "new object count"

    - use && whenever possible to catch errors early

    - use test_tick instead of GIT_AUTHOR_DATE=$sec

    - remove debugging aid log.txt

    - use subshells instead of cd-ing around

Also merge the pull test into one large test.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-27 00:06:12 -07:00
Junio C Hamano d7107ca65f completion: fix PS1 display during an AM on detached HEAD
This is a companion patch to previous 8763dbb (completion: fix PS1 display
during a merge on detached HEAD, 2009-05-16).  While rebasing or running am
on a detached HEAD, the code failed to set $b (branch description) that
enables the whole status display business.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-27 00:01:28 -07:00
Benjamin Kramer 94ad243702 imap-send: add support for IPv6
Add IPv6 support by implementing name resolution with the
protocol agnostic getaddrinfo(3) API. The old gethostbyname(3)
code is still available when git is compiled with NO_IPV6.

Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-26 22:22:47 -07:00
Junio C Hamano 33fd7169ed Update draft release notes to 1.6.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 19:46:17 -07:00
Junio C Hamano 23807fa008 Merge branch 'maint'
* 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
2009-05-25 19:44:52 -07:00
Junio C Hamano e57cb01582 Prepare for 1.6.3.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 19:20:39 -07:00
Junio C Hamano 2a1feb92ee Merge branch 'js/maint-no-ln-across-libexec-and-bin' into maint
* js/maint-no-ln-across-libexec-and-bin:
  Add NO_CROSS_DIRECTORY_HARDLINKS support to the Makefile

Conflicts:
	Makefile
2009-05-25 19:04:29 -07:00
Junio C Hamano 5e04a1ee33 Merge branch 'lt/maint-diff-reduce-lstat' into maint
* lt/maint-diff-reduce-lstat:
  Teach 'git checkout' to preload the index contents
  Avoid unnecessary 'lstat()' calls in 'get_stat_data()'
2009-05-25 19:04:08 -07:00
Junio C Hamano 597a178246 Merge branch 'jm/format-patch-no-auto-n-when-k-is-given' into maint
* jm/format-patch-no-auto-n-when-k-is-given:
  format-patch let -k override a config-specified format.numbered
2009-05-25 19:03:52 -07:00
Junio C Hamano 5c44cc9ea2 Merge branch 'do/maint-merge-recursive-fix' into maint
* do/maint-merge-recursive-fix:
  merge-recursive: never leave index unmerged while recursing
2009-05-25 19:03:43 -07:00
Junio C Hamano 417653777a Merge branch 'jk/maint-1.6.0-trace-argv' into maint
* jk/maint-1.6.0-trace-argv:
  fix GIT_TRACE segfault with shell-quoted aliases

Conflicts:
	alias.c
2009-05-25 19:03:20 -07:00
Junio C Hamano 4619136c8b Merge branch 'np/push-delta' into maint
* np/push-delta:
  allow OFS_DELTA objects during a push
2009-05-25 19:02:11 -07:00
Junio C Hamano e82f625416 Merge branch 'ar/merge-one-file-diag' into maint
* ar/merge-one-file-diag:
  Clarify kind of conflict in merge-one-file helper
2009-05-25 19:01:59 -07:00
Junio C Hamano 2c5942dbae Merge branch 'ar/unlink-err' into maint
* 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
2009-05-25 19:01:50 -07:00
Junio C Hamano 43f8f560c0 Merge branch 'jk/maint-add-empty' into maint
* jk/maint-add-empty:
  add: don't complain when adding empty project root
2009-05-25 19:01:41 -07:00
Jeff King 0e5168fd18 fix cat-file usage message and documentation
cat-file with an object on the command line requires an
option to tell it what to output (type, size, pretty-print,
etc). However, the square brackets in the usage imply that
those options are not required. This patch switches them to
parentheses to indicate "required but grouped-OR" (curly
braces might also work, but this follows the convention used
already by "git stash").

While we're at it, let's change the <sha1> specifier in the
usage to <object>. That's what the documentation uses, and
it does actually use the regular object lookup.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-25 12:08:15 -07:00