Skip to content

Commit 9e4e8fc

Browse files
authored
Merge pull request #265 from igapyon/tiga0416hee
git-pseudo-squash の作業ブランチ自動生成に基点ブランチ名を付与
2 parents 08a2600 + 6ce9a1a commit 9e4e8fc

6 files changed

Lines changed: 33 additions & 37 deletions

File tree

docs/git/git-pseudo-squash-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
| ID | ラベル || 初期値 | 現行挙動 |
2424
|---|---|---|---|---|
2525
| `squashBaseBranch` | 基点ブランチ | text | `devel` | datalist候補あり。履歴クリアボタンあり。 |
26-
| `workBranch` | 作業ブランチ | text || 初期化時、空なら `tigaMMddxxx` 形式で自動補完。 |
26+
| `workBranch` | 作業ブランチ | text || 初期化時、空なら `<squashBaseBranch>-tigaMMddxxx` 形式で自動補完。基点ブランチが空なら `tigaMMddxxx`|
2727
| `shellEnvPowerShell` | PowerShell | checkbox | OFF | ONでPowerShell向け、OFFでPOSIX向けコマンド。 |
2828
| `lockOrigin` | リモート + origin と作業 | checkbox | ON | ONで `baseRemote`/`squashRemote``origin` に固定して入力を隠す。 |
2929
| `squashBaseScope` | 基点の参照先 | select | `remote` | `remote`/`local` 切替。 |

docs/git/git-pseudo-squash-src.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
</div>
105105
<div class="md-form-row md-form-row--nowrap">
106106
<div class="md-input-wrap md-input-wrap--inline">
107-
<lht-text-field-help field-id="workBranch" label="作業ブランチ" required placeholder="例: tiga0129a" field-class="md-outlined-field" help-text="これから作業するブランチ名です。未作成なら作成先として使います。生成コマンドにそのまま反映されます。"></lht-text-field-help>
107+
<lht-text-field-help field-id="workBranch" label="作業ブランチ" required placeholder="例: devel-tiga0129a" field-class="md-outlined-field" help-text="これから作業するブランチ名です。未作成なら作成先として使います。生成コマンドにそのまま反映されます。"></lht-text-field-help>
108108
<button type="button" class="md-icon-btn md-icon-btn--prominent md-input-action--inline" onclick="updateWorkBranchWithCurrentTime()" title="現在日時で更新" aria-label="現在日時で作業ブランチを更新">
109109
<svg viewBox="0 0 24 24" class="md-icon-small" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
110110
<use href="#md-icon-refresh" xlink:href="#md-icon-refresh"></use>

docs/git/git-pseudo-squash.html

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,7 +2664,7 @@
26642664
</div>
26652665
<div class="md-form-row md-form-row--nowrap">
26662666
<div class="md-input-wrap md-input-wrap--inline">
2667-
<lht-text-field-help field-id="workBranch" label="作業ブランチ" required placeholder="例: tiga0129a" field-class="md-outlined-field" help-text="これから作業するブランチ名です。未作成なら作成先として使います。生成コマンドにそのまま反映されます。"></lht-text-field-help>
2667+
<lht-text-field-help field-id="workBranch" label="作業ブランチ" required placeholder="例: devel-tiga0129a" field-class="md-outlined-field" help-text="これから作業するブランチ名です。未作成なら作成先として使います。生成コマンドにそのまま反映されます。"></lht-text-field-help>
26682668
<button type="button" class="md-icon-btn md-icon-btn--prominent md-input-action--inline" onclick="updateWorkBranchWithCurrentTime()" title="現在日時で更新" aria-label="現在日時で作業ブランチを更新">
26692669
<svg viewBox="0 0 24 24" class="md-icon-small" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
26702670
<use href="#md-icon-refresh" xlink:href="#md-icon-refresh"></use>
@@ -5045,6 +5045,18 @@ <h3 class="md-diff-dialog__title">PR整形の差分</h3>
50455045
return s1 + s2 + s3;
50465046
}
50475047

5048+
function buildTimedWorkBranchName(date = new Date()) {
5049+
const baseBranch = document.getElementById("squashBaseBranch")?.value.trim() || "";
5050+
const pad = (num) => String(num).padStart(2, "0");
5051+
const mm = pad(date.getMonth() + 1);
5052+
const dd = pad(date.getDate());
5053+
const hh = date.getHours();
5054+
const min = date.getMinutes();
5055+
const timeStr = convertTimeToThreeChars(hh, min);
5056+
const suffix = `tiga${mm}${dd}${timeStr}`;
5057+
return baseBranch ? `${baseBranch}-${suffix}` : suffix;
5058+
}
5059+
50485060
function getUseCurrentBranchSelected() {
50495061
const useCurrentBranch = document.getElementById("useCurrentBranch");
50505062
if (!useCurrentBranch) return true;
@@ -5191,28 +5203,14 @@ <h3 class="md-diff-dialog__title">PR整形の差分</h3>
51915203
function setDefaultWorkBranch() {
51925204
const input = document.getElementById("workBranch");
51935205
if (!input || input.value.trim()) return;
5194-
const now = new Date();
5195-
const pad = (num) => String(num).padStart(2, "0");
5196-
const mm = pad(now.getMonth() + 1);
5197-
const dd = pad(now.getDate());
5198-
const hh = now.getHours();
5199-
const min = now.getMinutes();
5200-
const timeStr = convertTimeToThreeChars(hh, min);
5201-
input.value = `tiga${mm}${dd}${timeStr}`;
5206+
input.value = buildTimedWorkBranchName();
52025207
regenerateAllCommands();
52035208
}
52045209

52055210
function updateWorkBranchWithCurrentTime() {
52065211
const input = document.getElementById("workBranch");
52075212
if (!input) return;
5208-
const now = new Date();
5209-
const pad = (num) => String(num).padStart(2, "0");
5210-
const mm = pad(now.getMonth() + 1);
5211-
const dd = pad(now.getDate());
5212-
const hh = now.getHours();
5213-
const min = now.getMinutes();
5214-
const timeStr = convertTimeToThreeChars(hh, min);
5215-
input.value = `tiga${mm}${dd}${timeStr}`;
5213+
input.value = buildTimedWorkBranchName();
52165214
regenerateAllCommands();
52175215
const saved = upsertWorkBranchListEntry({
52185216
requireRepoUrl: false,

docs/git/src/git-pseudo-squash/js/main.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@
4747
return s1 + s2 + s3;
4848
}
4949

50+
function buildTimedWorkBranchName(date = new Date()) {
51+
const baseBranch = document.getElementById("squashBaseBranch")?.value.trim() || "";
52+
const pad = (num) => String(num).padStart(2, "0");
53+
const mm = pad(date.getMonth() + 1);
54+
const dd = pad(date.getDate());
55+
const hh = date.getHours();
56+
const min = date.getMinutes();
57+
const timeStr = convertTimeToThreeChars(hh, min);
58+
const suffix = `tiga${mm}${dd}${timeStr}`;
59+
return baseBranch ? `${baseBranch}-${suffix}` : suffix;
60+
}
61+
5062
function getUseCurrentBranchSelected() {
5163
const useCurrentBranch = document.getElementById("useCurrentBranch");
5264
if (!useCurrentBranch) return true;
@@ -193,28 +205,14 @@
193205
function setDefaultWorkBranch() {
194206
const input = document.getElementById("workBranch");
195207
if (!input || input.value.trim()) return;
196-
const now = new Date();
197-
const pad = (num) => String(num).padStart(2, "0");
198-
const mm = pad(now.getMonth() + 1);
199-
const dd = pad(now.getDate());
200-
const hh = now.getHours();
201-
const min = now.getMinutes();
202-
const timeStr = convertTimeToThreeChars(hh, min);
203-
input.value = `tiga${mm}${dd}${timeStr}`;
208+
input.value = buildTimedWorkBranchName();
204209
regenerateAllCommands();
205210
}
206211

207212
function updateWorkBranchWithCurrentTime() {
208213
const input = document.getElementById("workBranch");
209214
if (!input) return;
210-
const now = new Date();
211-
const pad = (num) => String(num).padStart(2, "0");
212-
const mm = pad(now.getMonth() + 1);
213-
const dd = pad(now.getDate());
214-
const hh = now.getHours();
215-
const min = now.getMinutes();
216-
const timeStr = convertTimeToThreeChars(hh, min);
217-
input.value = `tiga${mm}${dd}${timeStr}`;
215+
input.value = buildTimedWorkBranchName();
218216
regenerateAllCommands();
219217
const saved = upsertWorkBranchListEntry({
220218
requireRepoUrl: false,

docs/git/tests/git-pseudo-squash-main.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ prompt-gen の GitHub 導線追加
355355
expect(window.__gitPseudoSquashTest.getUseCurrentBranchSelected()).toBe(true);
356356
expect(document.getElementById("squashBaseBranch").value).toBe("devel");
357357
expect(document.getElementById("commitMessage").value).toBe("");
358-
expect(document.getElementById("workBranch").value).toMatch(/^tiga\d{4}[a-z]{3}$/);
358+
expect(document.getElementById("workBranch").value).toMatch(/^devel-tiga\d{4}[a-z]{3}$/);
359359
expect(localStorage.removeItem).toHaveBeenCalledWith("gitPseudoSquash.ui.baseRemote");
360360
expect(localStorage.removeItem).toHaveBeenCalledWith("gitPseudoSquash.ui.squashRemote");
361361
expect(localStorage.removeItem).toHaveBeenCalledWith("gitPseudoSquash.ui.useCurrentBranch");

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2174,7 +2174,7 @@
21742174
</lht-help-tooltip>
21752175
</div>
21762176
</div>
2177-
<div class="md-app-meta">更新日: 2026-04-16</div>
2177+
<div class="md-app-meta">更新日: 2026-06-06</div>
21782178
</div>
21792179
</header>
21802180

0 commit comments

Comments
 (0)