2323
2424
2525@click .command ()
26+ @click .option (
27+ '--name' ,
28+ help = "repository name" ,
29+ )
2630@click .option (
2731 '--source' ,
2832 help = "repository path" ,
5155 resolve_path = True , allow_dash = True ),
5256)
5357@click .pass_context
54- def commit (ctx , source : str , executable : bool , max_days : int , scrub_pii : bool , import_git_log_output : str ):
58+ def commit (ctx , name : str , source : str , executable : bool , max_days : int , scrub_pii : bool , import_git_log_output : str ):
5559 if executable == 'docker' :
5660 sys .exit ("--executable docker is no longer supported" )
5761
@@ -80,8 +84,10 @@ def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, i
8084 client .print_exception_and_recover (e )
8185
8286 cwd = os .path .abspath (source )
87+ if not name :
88+ name = os .path .basename (cwd )
8389 try :
84- exec_jar (cwd , max_days , ctx .obj , is_collect_message , is_collect_files )
90+ exec_jar (name , cwd , max_days , ctx .obj , is_collect_message , is_collect_files )
8591 except Exception as e :
8692 if os .getenv (REPORT_ERROR_KEY ):
8793 raise e
@@ -91,7 +97,7 @@ def commit(ctx, source: str, executable: bool, max_days: int, scrub_pii: bool, i
9197 "If not, please set a directory use by --source option.\n error: {}" .format (cwd , e ))
9298
9399
94- def exec_jar (source : str , max_days : int , app : Application , is_collect_message : bool , is_collect_files : bool ):
100+ def exec_jar (name : str , source : str , max_days : int , app : Application , is_collect_message : bool , is_collect_files : bool ):
95101 java = get_java_command ()
96102
97103 if not java :
@@ -106,7 +112,6 @@ def exec_jar(source: str, max_days: int, app: Application, is_collect_message: b
106112 command .extend ([
107113 "-jar" ,
108114 cygpath (jar_file_path ),
109- "ingest:commit" ,
110115 "-endpoint" ,
111116 "{}/intake/" .format (base_url ),
112117 "-max-days" ,
@@ -125,6 +130,7 @@ def exec_jar(source: str, max_days: int, app: Application, is_collect_message: b
125130 command .append ("-files" )
126131 if os .getenv (COMMIT_TIMEOUT ):
127132 command .append ("-enable-timeout" )
133+ command .append (name )
128134 command .append (cygpath (source ))
129135
130136 subprocess .run (
0 commit comments