t1400-update-ref: Add test verifying bug with symrefs in delete_ref()

When deleting a ref through a symref (e.g. using 'git update-ref -d HEAD'
to delete refs/heads/master), we currently fail to remove the packed
version of that ref. This testcase demonstrates the bug.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix failure to delete a packed ref through a symref

When deleting a ref through a symref (e.g. using 'git update-ref -d HEAD'
to delete refs/heads/master), we would remove the loose ref, but a packed
version of the same ref would remain, the end result being that instead of
deleting refs/heads/master we would appear to reset it to its state as of
the last repack.

This patch fixes the issue, by making sure we pass the correct ref name
when invoking repack_without_ref() from within delete_ref().

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git symbolic-ref --delete $symref

Teach symbolic-ref to delete symrefs by adding the -d/--delete option to
git-symbolic-ref. Both proper and dangling symrefs are deleted by this
option, but other refs - or anything else that is not a symref - is not.

The symref deletion is performed by first verifying that we are given a
proper symref, and then invoking delete_ref() on it with the REF_NODEREF
flag.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jm/diff-context-config' into jch

Teaches a new configuration variable to "git diff" Porcelain and
its friends.

Will merge to 'master' in the first batch after 1.8.0 ships.

* jm/diff-context-config:
  t4055: avoid use of sed 'a' command
  diff: diff.context configuration gives default to -U
Merge branch 'jl/submodule-rm' into jch

"git rm submodule" cannot blindly remove a submodule directory as
its working tree may have local changes, and worse yet, it may even
have its repository embedded in it.  Teach it some special cases
where it is safe to remove a submodule, specifically, when there is
no local changes in the submodule working tree, and its repository
is not embedded in its working tree but is elsewhere and uses the
gitfile mechanism to point at it.

Will merge to 'master' in the second batch after 1.8.0 ships.

* jl/submodule-rm:
  submodule: teach rm to remove submodules unless they contain a git directory
Merge branch 'rc/maint-complete-git-p4' into jch

Comment from Pete will need to be addressed in a follow-up patch.

* rc/maint-complete-git-p4:
  Teach git-completion about git p4
Merge branch 'fa/remote-svn' into jch

A GSoC project.
Will merge to 'master' in the first batch after 1.8.0 ships.

* fa/remote-svn:
  Add a test script for remote-svn
  remote-svn: add marks-file regeneration
  Add a svnrdump-simulator replaying a dump file for testing
  remote-svn: add incremental import
  remote-svn: Activate import/export-marks for fast-import
  Create a note for every imported commit containing svn metadata
  vcs-svn: add fast_export_note to create notes
  Allow reading svn dumps from files via file:// urls
  remote-svn, vcs-svn: Enable fetching to private refs
  When debug==1, start fast-import with "--stats" instead of "--quiet"
  Add documentation for the 'bidi-import' capability of remote-helpers
  Connect fast-import to the remote-helper via pipe, adding 'bidi-import' capability
  Add argv_array_detach and argv_array_free_detached
  Add svndump_init_fd to allow reading dumps from arbitrary FDs
  Add git-remote-testsvn to Makefile
  Implement a remote helper for svn in C
Merge branch 'jl/submodule-add-by-name' into jch

If you remove a submodule, in order to keep the repository so that
"git checkout" to an older commit in the superproject history can
resurrect the submodule, the real repository will stay in $GIT_DIR
of the superproject.  A later "git submodule add $path" to add a
different submodule at the same path will fail.  Diagnose this case
a bit better, and if the user really wants to add an unrelated
submodule at the same path, give the "--name" option to give it a
place in $GIT_DIR of the superproject that does not conflict with
the original submodule.

Will merge to 'master' in the second batch after 1.8.0 ships.

* jl/submodule-add-by-name:
  submodule add: Fail when .git/modules/<name> already exists unless forced
  Teach "git submodule add" the --name option
Merge branch 'bw/config-lift-variable-name-length-limit' into jch

The configuration parser had an unnecessary hardcoded limit on
variable names that was not checked consistently. Lift the limit.

Will merge to 'master' in the first batch after 1.8.0 ships.

* bw/config-lift-variable-name-length-limit:
  Remove the hard coded length limit on variable names in config files
Merge branch 'jk/peel-ref' into jch

Speeds up "git upload-pack" (what is invoked by "git fetch" on the
other side of the connection) by reducing the cost to advertise the
branches and tags that are available in the repository.

Will merge to 'master' in the first batch after 1.8.0 ships.

* jk/peel-ref:
  upload-pack: use peel_ref for ref advertisements
  peel_ref: check object type before loading
  peel_ref: do not return a null sha1
  peel_ref: use faster deref_tag_noverify
Merge branch 'nd/attr-match-optim' into jch

Trivial and obvious optimization for finding attributes that match
a given path.

Will merge to 'master' in the first batch after 1.8.0 ships.

* nd/attr-match-optim:
  attr: avoid searching for basename on every match
  attr: avoid strlen() on every match
Merge branch 'jc/add-delete-default' into jch

"git add dir/" updated modified files and added new files, but does
not notice removed files, which may be "Huh?" to some users.  They
can of course use "git add -A dir/", but why should they?

Resurrected from graveyard, as I thought it was a worthwhile thing
to do in the longer term.

Waiting for comments.

* jc/add-delete-default:
  git add: notice removal of tracked paths by default
Merge branch 'jc/grep-pcre-loose-ends' into jch

"git log -F -E --grep='<ere>'" failed to use the given <ere>
pattern as extended regular expression, and instead looked for the
string literally.  The early part of this series is a fix for it.

Will merge to 'master' in the second batch after 1.8.0 ships.

* jc/grep-pcre-loose-ends:
  log: honor grep.* configuration
  log --grep: accept --basic-regexp and --perl-regexp
  log --grep: use the same helper to set -E/-F options as "git grep"
  revisions: initialize revs->grep_filter using grep_init()
  grep: move pattern-type bits support to top-level grep.[ch]
  grep: move the configuration parsing logic to grep.[ch]
  builtin/grep.c: make configuration callback more reusable
Merge branch 'km/send-email-compose-encoding' into jch

"git send-email --compose" can let the user create a non-ascii
cover letter message, but there was not a way to mark it with
appropriate content type before sending it out.

Will merge to 'master' in the second batch after 1.8.0 ships.

* km/send-email-compose-encoding:
  git-send-email: introduce compose-encoding
Merge branch 'so/prompt-command' into jch

Updates __git_ps1 so that it can be used as $PROMPT_COMMAND,
instead of being used for command substitution in $PS1, to embed
color escape sequences in its output.

* so/prompt-command:
  coloured git-prompt: paint detached HEAD marker in red
  Fix up colored git-prompt
  show color hints based on state of the git tree
  Allow __git_ps1 to be used in PROMPT_COMMAND
Merge branch 'jc/test-say-color-avoid-echo-escape' into jch

Recent nd/wildmatch series was the first to reveal this ancient bug
in the test scaffolding.

Will merge to 'master' in the first batch after 1.8.0 ships.

* jc/test-say-color-avoid-echo-escape:
  test-lib: Fix say_color () not to interpret \a\b\c in the message
Merge branch 'jk/no-more-pre-exec-callback' into jch

(Originally merged to 'next' on 2012-07-23)
Removes a workaround for buggy version of less older than version
406.

Will merge to 'master' in the first batch after 1.8.0 ships.

* jk/no-more-pre-exec-callback:
  pager: drop "wait for output to run less" hack
Merge branch 'da/mergetools-p4' into jch

Will merge to 'master' in the first batch after 1.8.0 ships.

* da/mergetools-p4:
  mergetools/p4merge: Handle "/dev/null"
Merge branch 'jk/maint-http-init-not-in-result-handler' into jch

Further clean-up to the http codepath that picks up results after
cURL library is done with one request slot.

Will merge to 'master' in the second batch after 1.8.0 ships.

* jk/maint-http-init-not-in-result-handler:
  http: do not set up curl auth after a 401
  remote-curl: do not call run_slot repeatedly
Merge branch 'nd/grep-true-path' into jch

"git grep -e pattern <tree>" asked the attribute system to read
"<tree>:.gitattributes" file in the working tree, which was
nonsense.

Will merge to 'master' in the second batch after 1.8.0 ships.

* nd/grep-true-path:
  grep: stop looking at random places for .gitattributes