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

Commit83ebc65

Browse files
committed
Merge branch 'barry-scott-master'
2 parentsa4ad7ce +df95898 commit83ebc65

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

‎git/cmd.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ class Git(LazyMixin):
246246
# Enables debugging of GitPython's git commands
247247
GIT_PYTHON_TRACE=os.environ.get("GIT_PYTHON_TRACE",False)
248248

249+
# value of Windows process creation flag taken from MSDN
250+
CREATE_NO_WINDOW=0x08000000
251+
249252
# Provide the full path to the git executable. Otherwise it assumes git is in the path
250253
_git_exec_env_var="GIT_PYTHON_GIT_EXECUTABLE"
251254
GIT_PYTHON_GIT_EXECUTABLE=os.environ.get(_git_exec_env_var,git_exec_name)
@@ -608,6 +611,7 @@ def execute(self, command,
608611
cmd_not_found_exception=OSError
609612
# end handle
610613

614+
creationflags=self.CREATE_NO_WINDOWifsys.platform=='win32'else0
611615
try:
612616
proc=Popen(command,
613617
env=env,
@@ -619,6 +623,7 @@ def execute(self, command,
619623
shell=self.USE_SHELL,
620624
close_fds=(os.name=='posix'),# unsupported on windows
621625
universal_newlines=universal_newlines,
626+
creationflags=creationflags,
622627
**subprocess_kwargs
623628
)
624629
exceptcmd_not_found_exceptionaserr:
@@ -629,7 +634,7 @@ def execute(self, command,
629634

630635
def_kill_process(pid):
631636
""" Callback method to kill a process. """
632-
p=Popen(['ps','--ppid',str(pid)],stdout=PIPE)
637+
p=Popen(['ps','--ppid',str(pid)],stdout=PIPE,creationflags=creationflags)
633638
child_pids= []
634639
forlineinp.stdout:
635640
iflen(line.split())>0:

‎git/refs/log.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def from_line(cls, line):
114114
newhexsha=info[41:81]
115115
forhexshain (oldhexsha,newhexsha):
116116
ifnotcls._re_hexsha_only.match(hexsha):
117-
raiseValueError("Invalid hexsha: %s"%hexsha)
117+
raiseValueError("Invalid hexsha: %r"%(hexsha,))
118118
# END if hexsha re doesn't match
119119
# END for each hexsha
120120

@@ -274,11 +274,12 @@ def append_entry(cls, config_reader, filepath, oldbinsha, newbinsha, message):
274274
raiseValueError("Shas need to be given in binary format")
275275
# END handle sha type
276276
assure_directory_exists(filepath,is_file=True)
277+
first_line=message.split('\n')[0]
277278
committer=isinstance(config_reader,Actor)andconfig_readerorActor.committer(config_reader)
278279
entry=RefLogEntry((
279280
bin_to_hex(oldbinsha).decode('ascii'),
280281
bin_to_hex(newbinsha).decode('ascii'),
281-
committer, (int(time.time()),time.altzone),message
282+
committer, (int(time.time()),time.altzone),first_line
282283
))
283284

284285
lf=LockFile(filepath)

‎git/test/test_repo.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,12 +775,23 @@ def test_empty_repo(self, rw_dir):
775775
new_file_path=os.path.join(rw_dir,"new_file.ext")
776776
touch(new_file_path)
777777
r.index.add([new_file_path])
778-
r.index.commit("initial commit")
778+
r.index.commit("initial commit\nBAD MESSAGE 1\n")
779779

780780
# Now a branch should be creatable
781781
nb=r.create_head('foo')
782782
assertnb.is_valid()
783783

784+
withopen(new_file_path,'w')asf:
785+
f.write('Line 1\n')
786+
787+
r.index.add([new_file_path])
788+
r.index.commit("add line 1\nBAD MESSAGE 2\n")
789+
790+
withopen('%s/.git/logs/refs/heads/master'% (rw_dir,),'r')asf:
791+
contents=f.read()
792+
793+
assert'BAD MESSAGE'notincontents,'log is corrupt'
794+
784795
deftest_merge_base(self):
785796
repo=self.rorepo
786797
c1='f6aa8d1'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp