# [BUG] pull faulty 'not uptodate'

7 messages from 2008-08-20 to 2008-08-20. Participants: Pieter de Bie, Junio C Hamano, Miklos Vajna.
Thread: https://gitlist.dev/t/15115

## Pieter de Bie, 2008-08-20 21:00

Subject: [BUG] pull faulty 'not uptodate'
Message-ID: <1508D1DF-EDE7-4A64-B354-E2F26578E24D@ai.rug.nl>
URL: https://gitlist.dev/e/1508D1DF-EDE7-4A64-B354-E2F26578E24D%40ai.rug.nl

```
Hi,

I think git pull does not refresh the index before trying to merge:

Tirana:gitbot pieter$ git reset --hard 5ff4dff
HEAD is now at 5ff4dff Add a Git FAQ plugin
Tirana:gitbot pieter$ touch test/gitfaq.rb
Tirana:gitbot pieter$ git pull
Updating 5ff4dff..931a247
error: Entry 'test/gitfaq.rb' not uptodate. Cannot merge.
Tirana:gitbot pieter$ git st
# On branch master
# Your branch is behind 'origin/master' by 2 commits, and can be fast- 
forwarded.
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	GitLink.py
#	faq.yaml
#	test.py
nothing added to commit but untracked files present (use "git add" to  
track)
Tirana:gitbot pieter$ git pull
Updating 5ff4dff..931a247
Fast forward
  plugins/gitfaq.rb  |   46 ++++++++++++++++++++++--------------------
  plugins/irc.rb     |   56 +++++++++++++++++++++++++ 
+-------------------------
  test/faq-test.html |   10 +++++++++
  test/gitfaq.rb     |   42 +++++++++++++++++++-------------------
  4 files changed, 84 insertions(+), 70 deletions(-)
  create mode 100644 test/faq-test.html

```

## Junio C Hamano, 2008-08-20 21:22

Subject: Re: [BUG] pull faulty 'not uptodate'
Message-ID: <7v7iabpejv.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v7iabpejv.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <1508D1DF-EDE7-4A64-B354-E2F26578E24D@ai.rug.nl>

```
Pieter de Bie <pdebie@ai.rug.nl> writes:

> I think git pull does not refresh the index before trying to merge:

Yeah, that is another regression from C rewrite.  Thanks for reporting.

But I also have to wonder why a git-list regular like you are reporting
this _long after_ v1.6.0-rc1 was released.  Perhaps this is not really a
big-deal bug spelled in capital letters like you have on your Subject
line?

```

## Pieter de Bie, 2008-08-20 21:29

Subject: Re: [bug] pull faulty 'not uptodate'
Message-ID: <EAFC48F0-5512-4A83-B9B2-44FF53319285@ai.rug.nl>
URL: https://gitlist.dev/e/EAFC48F0-5512-4A83-B9B2-44FF53319285%40ai.rug.nl
In-Reply-To: <7v7iabpejv.fsf@gitster.siamese.dyndns.org>

```

On Aug 20, 2008, at 11:22 PM, Junio C Hamano wrote:
> But I also have to wonder why a git-list regular like you are  
> reporting
> this _long after_ v1.6.0-rc1 was released.  Perhaps this is not  
> really a
> big-deal bug spelled in capital letters like you have on your Subject
> line?

I just noticed it and wanted to report it. I thought the usual way to  
do this is to put [BUG] in the subject line. If that is not the common  
way to report bugs, I'm sorry. I can also downcase it ;)

- Pieter

```

## Junio C Hamano, 2008-08-20 21:50

Subject: Re: [bug] pull faulty 'not uptodate'
Message-ID: <7vy72rnyor.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vy72rnyor.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <EAFC48F0-5512-4A83-B9B2-44FF53319285@ai.rug.nl>

```
Pieter de Bie <pdebie@ai.rug.nl> writes:

> On Aug 20, 2008, at 11:22 PM, Junio C Hamano wrote:
>> But I also have to wonder why a git-list regular like you are
>> reporting
>> this _long after_ v1.6.0-rc1 was released.  Perhaps this is not
>> really a
>> big-deal bug spelled in capital letters like you have on your Subject
>> line?
>
> I just noticed it and wanted to report it. I thought the usual way to
> do this is to put [BUG] in the subject line. If that is not the common
> way to report bugs, I'm sorry. I can also downcase it ;)

Nah, don't bother --- that wouldn't help.

Checking if it is a regression ("it used to work but recently broken") or
a bug ("it does not work as I expect it") and marking the report as such
would have helped, though.

```

## Junio C Hamano, 2008-08-20 21:50

Subject: Re: [bug] pull faulty 'not uptodate'
Message-ID: <7vwsibnyof.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vwsibnyof.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <EAFC48F0-5512-4A83-B9B2-44FF53319285@ai.rug.nl>

```
Pieter de Bie <pdebie@ai.rug.nl> writes:

> On Aug 20, 2008, at 11:22 PM, Junio C Hamano wrote:
>> But I also have to wonder why a git-list regular like you are
>> reporting
>> this _long after_ v1.6.0-rc1 was released.  Perhaps this is not
>> really a
>> big-deal bug spelled in capital letters like you have on your Subject
>> line?
>
> I just noticed it and wanted to report it. I thought the usual way to
> do this is to put [BUG] in the subject line. If that is not the common
> way to report bugs, I'm sorry. I can also downcase it ;)

Nah, don't bother --- that wouldn't help.  A bug is a bug is a bug.

Checking if it is a regression ("it used to work but recently broken") or
a bug ("it does not work as I expect it") and marking the report as such
would have helped, though.

```

## Junio C Hamano, 2008-08-20 22:09

Subject: "git-merge": allow fast-forwarding in a stat-dirty tree
Message-ID: <7vljyrnxt3.fsf_-_@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vljyrnxt3.fsf_-_%40gitster.siamese.dyndns.org
In-Reply-To: <EAFC48F0-5512-4A83-B9B2-44FF53319285@ai.rug.nl>

```
We used to refresh the index to clear stat-dirtyness before a fast-forward
merge.  Recent C rewrite forgot to do this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-merge.c  |    2 +-
 t/t7600-merge.sh |   10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git c/builtin-merge.c w/builtin-merge.c
index dde0c7e..a201c66 100644
--- c/builtin-merge.c
+++ w/builtin-merge.c
@@ -566,6 +566,7 @@ static int checkout_fast_forward(unsigned char *head, unsigned char *remote)
 
 	if (read_cache_unmerged())
 		die("you need to resolve your current index first");
+	refresh_cache(REFRESH_QUIET);
 
 	fd = hold_locked_index(lock_file, 1);
 
@@ -936,7 +937,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 			hex,
 			find_unique_abbrev(remoteheads->item->object.sha1,
 			DEFAULT_ABBREV));
-		refresh_cache(REFRESH_QUIET);
 		strbuf_init(&msg, 0);
 		strbuf_addstr(&msg, "Fast forward");
 		if (have_message)
diff --git c/t/t7600-merge.sh w/t/t7600-merge.sh
index 5eeb6c2..fee8fb7 100755
--- c/t/t7600-merge.sh
+++ w/t/t7600-merge.sh
@@ -488,4 +488,14 @@ test_expect_success 'merge c1 with c1 and c2' '
 
 test_debug 'gitk --all'
 
+test_expect_success 'merge fast-forward in a dirty tree' '
+       git reset --hard c0 &&
+       mv file file1 &&
+       cat file1 >file &&
+       rm -f file1 &&
+       git merge c2
+'
+
+test_debug 'gitk --all'
+
 test_done

```

## Miklos Vajna, 2008-08-20 22:35

Subject: Re: "git-merge": allow fast-forwarding in a stat-dirty tree
Message-ID: <20080820223511.GM23800@genesis.frugalware.org>
URL: https://gitlist.dev/e/20080820223511.GM23800%40genesis.frugalware.org
In-Reply-To: <7vljyrnxt3.fsf_-_@gitster.siamese.dyndns.org>

```
On Wed, Aug 20, 2008 at 03:09:28PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
>  	if (read_cache_unmerged())
>  		die("you need to resolve your current index first");
> +	refresh_cache(REFRESH_QUIET);

I did not realise that we need a refresh_cache() after
read_cache_unmerged() here, and thus the other refresh_cache() call is
unnecessary.

Thanks.

```
