summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-02-07 23:14:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-02-07 23:14:22 (GMT)
commit427c6d0caf0caee5ad2c4925910a6b8ebcf95408 (patch)
treeea73fd905a86866dfb95976b13f2e1cda00bbd67 /builtin
parent45bb6cbb49699a64196ed866c4809cd8267bd481 (diff)
parente28efb1998bb0b73057de13b9568f6aef439a583 (diff)
downloadgit-427c6d0caf0caee5ad2c4925910a6b8ebcf95408.zip
git-427c6d0caf0caee5ad2c4925910a6b8ebcf95408.tar.gz
git-427c6d0caf0caee5ad2c4925910a6b8ebcf95408.tar.bz2
Merge branch 'jc/fake-ancestor-with-non-blobs' into maint
Rebasing the history of superproject with change in the submodule has been broken since v1.7.12. * jc/fake-ancestor-with-non-blobs: apply: diagnose incomplete submodule object name better apply: simplify build_fake_ancestor() git-am: record full index line in the patch used while rebasing
Diffstat (limited to 'builtin')
-rw-r--r--builtin/apply.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 6c11e8b..9706ca7 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3609,7 +3609,6 @@ static void build_fake_ancestor(struct patch *list, const char *filename)
* worth showing the new sha1 prefix, but until then...
*/
for (patch = list; patch; patch = patch->next) {
- const unsigned char *sha1_ptr;
unsigned char sha1[20];
struct cache_entry *ce;
const char *name;
@@ -3617,20 +3616,23 @@ static void build_fake_ancestor(struct patch *list, const char *filename)
name = patch->old_name ? patch->old_name : patch->new_name;
if (0 < patch->is_new)
continue;
- else if (get_sha1_blob(patch->old_sha1_prefix, sha1))
- /* git diff has no index line for mode/type changes */
- if (!patch->lines_added && !patch->lines_deleted) {
- if (get_current_sha1(patch->old_name, sha1))
- die("mode change for %s, which is not "
- "in current HEAD", name);
- sha1_ptr = sha1;
- } else
- die("sha1 information is lacking or useless "
- "(%s).", name);
- else
- sha1_ptr = sha1;
- ce = make_cache_entry(patch->old_mode, sha1_ptr, name, 0, 0);
+ if (S_ISGITLINK(patch->old_mode)) {
+ if (get_sha1_hex(patch->old_sha1_prefix, sha1))
+ die("submoule change for %s without full index name",
+ name);
+ } else if (!get_sha1_blob(patch->old_sha1_prefix, sha1)) {
+ ; /* ok */
+ } else if (!patch->lines_added && !patch->lines_deleted) {
+ /* mode-only change: update the current */
+ if (get_current_sha1(patch->old_name, sha1))
+ die("mode change for %s, which is not "
+ "in current HEAD", name);
+ } else
+ die("sha1 information is lacking or useless "
+ "(%s).", name);
+
+ ce = make_cache_entry(patch->old_mode, sha1, name, 0, 0);
if (!ce)
die(_("make_cache_entry failed for path '%s'"), name);
if (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD))