Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commandgit merge-base --is-ancestor not working as expected #321

Closed
@bwrsandman

Description

@bwrsandman

Description

Using:

  • git version 2.4.6
  • gitdb==0.6.4
  • GitPython==1.0.1

The use case forgit merge-base --is-ancestor from git manpage:

Check if the first is an ancestor of the second , and exit with status 0 if true, or with status 1 if not. Errors are signaled by a non-zero status that is not 1.

Related to#169 (comment)

The problem is that the output ofgit merge-base --is-ancestor comes from the return code and unlike without the--is-ancestor flag, this command doesn't return commit SHAs but is a simple yes-no check. The current implementation doesn't take into account the return code and the command cannot be usefully run.

Current Behaviour

revA is ancestor to revB

$ git merge-base --is-ancestor$revA$revB;echo$?0
>>>repo.merge_base(revA,revB,is_ancestor=True)[ ]

revA is not ancestor to revB

$ git merge-base --is-ancestor$revA$revB;echo$?1
>>>repo.merge_base(revA,revB,is_ancestor=True)[ ]

revA is not ancestor to revB and revB doesn't exist

$ git merge-base --is-ancestor$revA$revB;echo$?fatal: Not a valid commit name$revB128
>>>repo.merge_base(revA,revB,is_ancestor=True)GitCommandError:'git merge-base --is-ancestor $revA $revB'returnedwithexitcode128stderr:'fatal: Not a valid commit name $revB'

Desired Behaviour

When thekwargis_ancestor is used, don't return a list, but return a bool that is true if the return code is 0. Return False if return code is 1. Raise Error as before for all other cases

$ git merge-base --is-ancestor$revA$revB;echo$?0
>>>repo.merge_base(revA,revB,is_ancestor=True)True

revA is not ancestor to revB

$ git merge-base --is-ancestor$revA$revB;echo$?1
>>>repo.merge_base(revA,revB,is_ancestor=True)False

revA is not ancestor to revB and revB doesn't exist

$ git merge-base --is-ancestor$revA$revB;echo$?fatal: Not a valid commit name$revB128
>>>repo.merge_base(revA,revB,is_ancestor=True)GitCommandError:'git merge-base --is-ancestor $revA $revB'returnedwithexitcode128stderr:'fatal: Not a valid commit name $revB'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp