Project

General

Profile

Actions

Defect #5628

closed

Wrong commit range in git log command

Added by Sheng Wang over 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Category:
SCM
Target version:
Start date:
2010-06-01
Due date:
% Done:

100%

Estimated time:
Resolution:
Affected version:

Description

Special file:

lib/redmine/scm/adapters/git_adapter.rb

Special coding:
def revisions(path, identifier_from, identifier_to, options={})
  revisions = Revisions.new
  cmd = "#{GIT_BIN} --git-dir #{target('')} log --raw --date=iso --pretty=fuller" 
  cmd << " --reverse" if options[:reverse]
  cmd << " --all" if options[:all]
  cmd << " -n #{options[:limit]} " if options[:limit]
  cmd << " #{shell_quote(identifier_from + '..')} " if identifier_from
  cmd << " #{shell_quote identifier_to} " if identifier_to

the correct git log command are following:

git log identifier_from..identifier_to

but the above coding result is

git log identifier_from..  identifier_to

It lead to that all log from identifier_from will be displayed. All of these are caused by extra spaces, which leads to git ignore identifier_to as the limit of the range.

Example:

git log 2efdef32^..2efdef32
Only 2efdef32 commit will be displayed.

git log 2efdef32^..  2efdef32
All commits from 2efdef32 will displayed.


Files

0001-git_adapter.rb-Fix-whitespace-in-git-command.patch (1.56 KB) 0001-git_adapter.rb-Fix-whitespace-in-git-command.patch S. Christoffer Eliesen, 2010-06-24 22:41
5628_git.diff (1.94 KB) 5628_git.diff Jean-Baptiste Barth, 2010-06-26 11:45

Related issues

Related to Redmine - Defect #7657: Wrong commit range in git log command on WindowsClosedToshi MARUYAMA2011-02-18

Actions
Actions #1

Updated by Felix Schäfer over 14 years ago

  • Subject changed from there is an coding error to Wrong commit range in git log command
  • Assignee set to Eric Davis
  • Target version set to 1.0.0 (RC)

I don't use git, but as far as I understand the man page, this is valid.

Actions #2

Updated by S. Christoffer Eliesen over 14 years ago

I can confirm the behaviour outside of redmine. Attached patch should fix the problem.

Actions #3

Updated by Sheng Wang over 14 years ago

Great work! :)

I can confirm the behaviour outside of redmine.

I did confirm the behaviour outside of redmine. But these code that is not strict may lead to some unexpected error in future,if someone call these code.

Actions #4

Updated by Eric Davis over 14 years ago

  • Assignee deleted (Eric Davis)
  • Target version deleted (1.0.0 (RC))

Can someone update Redmine's test git repository and provide a unit test that exposes this bug?

Actions #5

Updated by Jean-Baptiste Barth over 14 years ago

I'd prefer playing with spaces on actual code, it seems to me a bit less risky.
Eric: no need to change actual repo in my opinion, but I added a unit test in attached diff (git format). Let me know what do you think.

Actions #6

Updated by Jean-Baptiste Barth about 14 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Baptiste Barth
  • Target version set to 1.0.1
  • % Done changed from 0 to 100
  • Affected version (unused) set to 1.0.0-RC

Applied in r3925

Actions #7

Updated by Eric Davis about 14 years ago

  • Status changed from Resolved to Closed

Merged to 1.0-stable for release in 1.0.1.

Actions #8

Updated by Toshi MARUYAMA over 13 years ago

This issue is not fixed on Windows.
I create new issue #7657.

Actions

Also available in: Atom PDF